LAB ASSIGNMENT
write a program the
does the following
Declare two constants, SIZE = 10, and MAXRANGE 1000
Create an array of size SIZE. Fill the array with random numbers. Range of
numbers are 0 to MAXRANGE. Print content of the array.
Write a function
BubbleSort that will sort the array using Bubble Sort algorithm. The function
BubbleSort calls a function swap every time
it needs to swap two numbers. Print
content of the sorted array.
Write a function
FindMax that will go through an entire array and print the largest number in the
array.
Use the maximum
value found before as an argument for a binarySearch function to see if the
number is
in the array and how many passes it took for binary search to find that number.
The following functions are REQUIRED to the lab. You do not have to write a
recursive version of FindMax.
int GetRandomNumber(const int MaxRange);
int FindMax( const int array[], int nHighestIndex, const int MaxRange);
void BubbleSort( int array[], int arraySize );
int binarySearch( const int b[], int searchKey, int nLow, int nHigh, int &nPassCount
);
void swap(int *p, int *q);