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

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadlines.


Order a Similar Paper Order a Different Paper

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…

"Is this question part of your assignment? We can help"

ORDER NOW

Do you need help with this or a different assignment? We offer CONFIDENTIAL, ORIGINAL (Turnitin/LopesWrite/SafeAssign checks), and PRIVATE services using latest (within 5 years) peer-reviewed articles. Kindly click on ORDER NOW to receive an A++ paper from our masters- and PhD writers.

Get a 15% discount on your order using the following coupon code SAVE15


Order a Similar Paper Order a Different Paper