Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Sort

Encapsulates useful sorting utilities.

Hierarchy

  • Sort

Index

Constructors

constructor

  • Returns Sort

Methods

getTypeString

  • getTypeString(): string
  • Returns string

Static Private doQuickSort

  • doQuickSort<T>(array: Array<T>, left: number, right: number, comparer: IFunction2<T, T, CompareResult>): void
  • internal

    Type parameters

    • T

    Parameters

    • array: Array<T>
    • left: number
    • right: number
    • comparer: IFunction2<T, T, CompareResult>

    Returns void

Static Private partition

  • partition<T>(array: Array<T>, left: number, right: number, pivotIndex: number, comparer: IFunction2<T, T, CompareResult>): number
  • internal

    Type parameters

    • T

    Parameters

    • array: Array<T>
    • left: number
    • right: number
    • pivotIndex: number
    • comparer: IFunction2<T, T, CompareResult>

    Returns number

Static quickSort

  • quickSort<T>(array: Array<T>, comparer: IFunction2<T, T, CompareResult>): void
  • Sorts an array using the in-place quick-sort algorithm.
    The type of elements in the array.

    Type parameters

    • T

    Parameters

    • array: Array<T>

      The array of elements.

    • comparer: IFunction2<T, T, CompareResult>

      The function used to compare elements in the array - should return less than 0 if item 1 is less than item 2 (item 1 should appear before item 2), 0 if the items are equal, or more than 0 is item 1 is greater than item 2 (item 1 should appear after item 2).

    Returns void

Static Private swap

  • swap<T>(array: Array<T>, pos1: number, pos2: number): void
  • internal

    Type parameters

    • T

    Parameters

    • array: Array<T>
    • pos1: number
    • pos2: number

    Returns void