Write a complete program that: Use the randon number generator to generate 50 numbers.Store these numbers in an input file. Put the numbers in order using the Insertion Sort. Search for a(any) number using the Sequential Search. Write a complete program that: Use the randon number generator to generate 50 numbers.Store these numbers in an input file. Put the numbers in order using the Insertion Sort. Search for a(any) number using the Sequential Search.
Explanation / Answer
//Hope this will help you.. #include #include #include using namespace std; void insertion_sort( int *array,int len ) { int i, j, key, array_length=len; ofstream myfile ("output.txt"); if (myfile.is_open()) { for(j = 1; j = 0) && (array[i] > key);i--) //Move smaller values up one position { array[i+1] = array[i]; } array[i+1] =key; //Insert key into proper position myfile