• Sorts the array anArray according to the comparator aCmpFun using a quick sort (https://en.wikipedia.org/wiki/Quicksort. The parameter aPickFun tells how to choose the pivot for splitting the array.

    The algorithm itself is described in the Cormen, chapter 7.1.

    Parameters

    • anArray: any[]

      the array to be sorted

    • aCmpFun: ((a1: any, a2: any) => number)

      a 2-parameter function returning a number n, telling if the 1st parameter is less-than (n < 0), equal (n == 0) or greater than the 2nd (n > 0)

        • (a1, a2): number
        • Parameters

          • a1: any
          • a2: any

          Returns number

    • aPickFun: ((a1: any[]) => any)

      a 1-parameter function returning an element of the array

        • (a1): any
        • Parameters

          • a1: any[]

          Returns any

    Returns any[]

    a new array with the same elements as anArray but sorted