Suppose you are given a sorted integer array and an integer that may or may not be present in the array. How will you find the smallest number in the array that is greater than the given integer?
We can use a modified binary search.
Running time = \( O(logn) \). public int findSmallestIntGreaterThnGiven(int[] array, int start, int end, int k){ |