Finding first and last occurrence of given number in sorted list is a very easy problem and can easily solved by leaner search with worse case Time complexity O(n) .
But We can Achieve faster search of first and last occurrence of a number by exploiting sorted feature of list.
We can search occurrence of any number in sorted list in O(log(n)) Time Complexity by using Binary search Algorithm.
But We can Achieve faster search of first and last occurrence of a number by exploiting sorted feature of list.
We can search occurrence of any number in sorted list in O(log(n)) Time Complexity by using Binary search Algorithm.