Name
rxsort
Synopsis
int rxsort(int*data
, intsize
, intp
, intk
);
Return Value
0 if sorting is successful, or -1 otherwise.
Description
Uses radix sort to sort the array of integers in
data
. The number of integers in
data
is specified by
size
. The argument
p
specifies the number of digit
positions in each integer. The argument
k
specifies the radix. When
rxsort returns,
data
contains the sorted
integers.
Complexity
O (pn + pk), where n is the number of integers to be sorted, k is the radix, and p is the number of digit positions.
Get Mastering Algorithms with C now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.