Wednesday, March 25, 2015
Insertion Sort
Here is the code for Insertion Sort.
Best of luck !!
#include <iostream>If you have any doubts, kindly leave them in the comments :)
using namespace std;
void ins_sort(int a[],int n)
{
for(int i = 1; i < n; i++)
{
int key = a[i];
int j = i-1;
while(j>=0 && a[j]>key)
{
a[j+1] = a[j];
j--;
}
a[j+1] = key;
}
}
int main()
{
int n;
cin>>n;
int a[n];
for(int i = 0; i < n; i++)
cin>>a[i];
ins_sort(a,n);
for(int i = 0; i < n; i++)
cout<<a[i]<<" ";
cout<<endl;
return 0;
}
Best of luck !!
Monday, March 23, 2015
Friday, March 20, 2015
Saturday, January 17, 2015
Tuesday, May 6, 2014
Monday, February 10, 2014
Thursday, April 18, 2013
HLOOKUP in Excel
In Microsoft Excel, the HLOOKUP function searches for value in the top row of table_array and returns the value in the same column based on the index_number.
Syntax
The syntax for the HLOOKUP function is:
HLOOKUP( value, table_array, index_number, [not_exact_match] )
value is the value to search for in the first row of the table_array.
table_array is two or more rows of data that is sorted in ascending order.
index_number is the row number in table_array from which the matching value must be returned. The first row is 1.
not_exact_match is optional. It determines if you are looking for an exact match based on value. Enter FALSE to find an exact match. Enter TRUE to find an approximate match, which means that if an exact match if not found, then the HLOOKUP function will look for the next largest value that is less than value. If this parameter is omitted, HLOOKUP will return an approximate match.
Note
- If index_number is less than 1, the HLOOKUP function will return #VALUE!.
- If index_number is greater than the number of columns in table_array, the HLOOKUP function will return #REF!.
- If you enter FALSE for the not_exact_match parameter and no exact match is found, then the HLOOKUP function will return #N/A.
Subscribe to:
Posts (Atom)