Please, send any comments to the address: <my user name> at ya.ru


Concerning your edits at Counting sort edit

Hi, I just wanted to draw your attention, that the page to which you refer, http://www.personal.kent.edu/~rmuhamma/Algorithms/MyAlgorithms/Sorting/countingSort.htm, and the wikipedia page on Counting sort, have two different algorithms working in two different directions. The page from kent.edu has c[1] holding the count of all elements with the lowest key, but the algo in WP has c[1] holding 0.

That is why the WP algo adds 1 to it, each time it adds its element to the sorted array, going along the original array from the bottom up. But the algo from kent subtracts 1 when it adds an element, going through the original array from top down.

Both are right, both are different, but one must use (+1), and the other must use (-1). Just changing (+1) to (-1) is wrong - there are other changes that must be made to the algorithm too, and in the end it will be just the same algorithm just working in the opposite direction.

Cheers, -- WillNess (talk) 08:55, 3 December 2011 (UTC)Reply