Function insertionIndex

Returns index to insert data into a sorted array using a binary search. Adds to the right of existing entries in the case of equal values.

By default uses Javascript comparision semantics. Passing in comparer is needed when working with an array of objects.

  • Type Parameters

    • T

    Parameters

    • data: T[]
    • toInsert: T
    • start: number = 0
    • end: number = data.length
    • comparer: Comparer<T> = defaultComparer

    Returns number