• Classic implementation of a binary search with a small tweak since we are using this for our bucketing algorithms.

    Rather than return -1 if the exact value is not found, we return whichever value our final mid is closest too. This ensures that we put our target into the correct bucket.

    Parameters

    • arr: number[]

      The array of numbers to search.

    • target: number

      The number that we are looking for.

    Returns number

    The index of the bucket our target should be placed in.

Generated using TypeDoc