package com.thealgorithms.searches; import com.thealgorithms.devutils.searches.SearchAlgorithm; /** * The LowerBound method is used to return an index pointing to the first * element in the range [first, last) which has a value not less than val, i.e. * the index of the next smallest number just greater than or equal to that * number. If there are multiple values that are equal to val it returns the * index of the first such value. * *
* This is an extension of BinarySearch. * *
* Worst-case performance O(log n) Best-case performance O(1) Average
* performance O(log n) Worst-case space complexity O(1)
*
* @author Pratik Padalia (https://github.com/15pratik)
* @see SearchAlgorithm
* @see BinarySearch
*/
class LowerBound implements SearchAlgorithm {
/**
* @param array is an array where the LowerBound value is to be found
* @param key is an element for which the LowerBound is to be found
* @param