Least significant digit (LSD) Radix sort. A non-comparative,
stable integer sorting algorithm.
Worst-case time complexity is O(N K) for N keys with K being the average key length, measured in number of digits.
Worst-case time complexity is O(N K) for N keys with K being the average key length, measured in number of digits.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
array |
Array
|
Input integer array |
Returns:
- Type:
-
Array
Sorted array
Example
var sort = require('path-to-algorithms/src/' +
'sorting/radixsort').radixSort;
console.log(sort([2, 5, 1, 3, 4])); // [ 1, 2, 3, 4, 5 ]