Please Visit: http://ift.tt/1ajReyV
from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1wxKKZ5
via LifeLong Community
java - Radix sort vs Counting sort vs Bucket sort. What's the difference? - Stack Overflow
Radix sort is sort based on this method. The problem with counting sort is memory requirement: int [] bucket=new int[maxVal+1];. Radix sort solves this problem. The idea is to use counting sort several times, first for lower digits, then for higher. For example, to sort 32-bit integers you might use:
sort(a, 65535) using lower half as key
sort(a, 65535) using higher half as key
It works, because counting sort is stable - it keeps order of data with equal keys. It's like sorting in spreadsheet: sort by B; sort by A gives you elements sorted by A, and by B when As are equal.
Bucket sort is a generalization of counting sort. You can use it to sort real numbers from some predictable probability distribution (eg. uniform (0,1)). The idea is to use counting sort (using floor(x*N_BUCKETS) as key) and then only sort each bucket independently.
http://ift.tt/1wxKNnG
Done
Radix sort is sort based on this method. The problem with counting sort is memory requirement: int [] bucket=new int[maxVal+1];. Radix sort solves this problem. The idea is to use counting sort several times, first for lower digits, then for higher. For example, to sort 32-bit integers you might use:
sort(a, 65535) using lower half as key
sort(a, 65535) using higher half as key
It works, because counting sort is stable - it keeps order of data with equal keys. It's like sorting in spreadsheet: sort by B; sort by A gives you elements sorted by A, and by B when As are equal.
Bucket sort is a generalization of counting sort. You can use it to sort real numbers from some predictable probability distribution (eg. uniform (0,1)). The idea is to use counting sort (using floor(x*N_BUCKETS) as key) and then only sort each bucket independently.
http://ift.tt/1wxKNnG
Done
from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1wxKKZ5
via LifeLong Community
No comments:
Post a Comment