Name

ctsort

Synopsis

int ctsort(int *data, int size, int k);

Return Value

0 if sorting is successful, or -1 otherwise.

Description

Uses counting sort to sort the array of integers in data. The number of integers in data is specified by size. The argument k specifies the maximum integer in data, plus 1. When ctsort returns, data contains the sorted integers.

Complexity

O (n + k), where n is the number of integers to be sorted and k is the maximum integer in the unsorted set, plus 1.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset