Question: 3. Suppose you have an integer array A with N elements (A and N are global). The array Ais sorted in ascending order. Function bin_search()
3. Suppose you have an integer array A with N elements (A and N are global). The array Ais sorted in ascending order. Function bin_search() performs a binary search of A for a key and returns the index of the key (or 1 if not found). The following C code on the left continuously subdivides a range in halves until the key is found or min and max cross each other. In the space on the right convert the C code to a Pseudo-C with goto's. int bin_search(int key) int found = 0; int j = 1; int mins0; int maxaN-1; int bin_search(int key int found = 0; int j = 1; Int min=0; int max-N-1; while (Ifound) { if (min > max) break; else { j = floor((minmax)/2); if (key A0)) found = 1; else if (key
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
