Sunday, June 15, 2008

Bucket Sort

Procedure Bucket Sort (A) :

The above procedure assumes that the input is an n-element array A, such that each element A [1] satisfies 0 £ A [i] <>


Step 1 Initialization
set n ¬ length [A]
Step 2 insertion at proper place, loop
for i ¬ 1 to n
insert element A [i] into list B [ ë n A [i] û ]
Step 3 sort the list, loop
for i ¬ 0 to n – 1
sort list B [i] using insertion sort.
Step 4 sorting, combining.
concatenate list B [0], B [1], .... B [n – 1] together in order.

No comments: