Returns the k-th element of an array anArray using the Median of medians algorithm.

if anIndex is greater than or equal to the length of anArray

  • Parameters

    • anArray: any[]

      the array to consider

    • anIndex: number

      the index of the element to find

    Returns any

    the k-th element of anArray