Given an array and an element , the floor of an element is defined as the greatest element present in the array which is less than or equal to .
What is the worst case complexity of the most efficient algorithm for finding a floor of an element in a sorted array?
Details and Assumptions :
If the array is and , then the output will be .
can't be less than the minimum element in the list.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Finding floor of an integer is O(1) operation .
Finding a particular integer x in a sorted array is O(log n) operation using binary search .
Combining these 2, worst case complexity of Array Floor algorithm is O(log n)