Skip to content

radixSort

radixSort<T>(items, valueOf): T[]

Defined in: sort/radix-sort.ts:17

Sorts items ascending by a non-negative integer key, stable — LSD radix sort, O(n · k) for k the number of 8-bit digits the largest key needs. Never calls a comparator, so it beats comparison sorts by a wide margin on large collections of integer-keyed items (raw numbers, coordinates, counts).

T

readonly T[]

The items to sort. Not modified; a new array is returned.

Callable<[T], number>

Extracts the non-negative integer sort key from an item.

T[]

A new array of items sorted ascending by valueOf.

If any key is negative or not a safe integer.