counting sort ( can sort 0-k Auxiliary Space: O(n+k) Time Complexity: O(n+k) )

http://www.youtube.com/watch?v=o3FUC6l89tM

http://www.geeksforgeeks.org/counting-sort/

 

only 0 - k   can not be negtive 

71522   最大7.

new array(7).

0 1 2 3 4 5 6 7

   1 2      1    1

 

计算位置

0 1 2 3 4 5 6 7

0 1 3 3 3 4 4 5

 

把位置分好,没分到一个 原位置减1

posted on 2014-10-24 06:25  brave_bo  阅读(159)  评论(0编辑  收藏  举报

导航