--------------------------------------------------------------------------------------------------------
Given a sorted array with repeating integers. You need to find the first occurence, last occurence and count
of a given key in the array. Use only Binary Search. Your algorithm should run in log(N) time.If element is not
present, print -1 -1 0.
Answers
Answered by
3
Answer:
Considering the following sorted array and the search key as 89, what will be the sequence of keys in the array that
are compared with 89 while binary searching for 89?
w
C
с C
20 30 38 47 48 49 51 67 73 75 78 84 89 92 98
Explanation:
first occurence, last occurence and count
of a given key in the array. Use only Binary Search. Your algorithm should run in log(N) time.If element is not
present, print -1 -1 0.
Similar questions