C-Programming-Binary-Search-Assignment-programming-homework-help

Write a function that searches, using the binary search algorithm, an integer array and returns the array position of the “found” integer that matches the search key. The function should be prototyped as follows:

int BinSearch(int data[],int numElements, int searchKey);

Use the following array for test purposes:

{1, 4, 5, 6, 9, 14, 21, 23, 28, 31, 35, 42, 46, 50, 53, 57, 62, 63, 65, 74, 79, 89, 95}

Your output should be similar to the following:

{1, 4, 5, 6, 9, 14, 21, 23, 28, 31, 35, 42, 46, 50, 53, 57, 62, 63, 65, 74, 79, 89, 95}
Enter search key (or ‘x’ to exit): 21
21 is in position 6.
Enter search key (or ‘x’ to exit): 50
50 is in position 13.
Enter search key (or ‘x’ to exit): 0
0 not found.
Enter search key (or ‘x’ to exit): x
Exiting…

 
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code "Newclient" for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.