A programmer writes a program to find an element in the array A[5] with the elements:8 30 40 45 70 the program is run to find a number X,that is found in the first iteration of binary search.what is the value of X?
Answers
Answered by
5
Answer:
it is a very difficult question i
Answered by
14
Answer:
Binary search is applied on the sorted arrays only. The array given is to be sorted. To sort the array, various iterations are done. In the first iteration we sort the array in two parts and position of middle element is fixed. left array has unsorted elementsless than the middle element and right array is an unsorted arry of elements of greater value than the middle element.so, first iteration gives value of X as 40.
Similar questions