For this sorted array if we search for key value 56 how can
For this sorted array, if we search for key value 56, how can we search using the minimun number of steps? Show the procedure.
1, 4, 8, 10, 15, 18, 50, 81, 288, 300, 384, 788, 898
Solution
The minimum number of steps is achieved using binary search.
Search key - 56
1st step - mid element = 50
56 > 50 hence search 2nd half
2nd step - mid element = 300
56<300 hence search 1st half
3rd step - mid element = 288
56<288 hence search 1st half which has no elements hence element is not found.
Im not sure whether question is correct ,i.e search key is 50 or 56 .the above process is for search key 56
but if it is 50 the search key is found in step 1 only.please check out accordingly
