409 views
0 votes
0 votes
BUCKET-SORT(A)
1      let B[0...n-1] be a new array
2      n = A.length
3      for i – 0 to n – 1
4      make B[i] an empty list
5      for i = 1 to n
6      insert A[i] into list B[nA[i]]
7      for i = 0 to n – 1
8      sort list B[i] with insertion sort
9      concatenate the lists B[0] , B[1] , ….,B[n-1] together in order

illustrate the operation of BUCKET-SORT on the array $A=\langle  .79,.13,.16,.64,.39,.20,.89,.53,.71,.42\rangle$

1 Answer

Related questions

1 votes
1 votes
1 answer
3
akash.dinkar12 asked Jun 28, 2019
705 views
Let $X$ be a random variable that is equal to the number of heads in two flips of a fair coin. What is $E[X^2]$? What is $E^2[X]$?
1 votes
1 votes
1 answer
4
akash.dinkar12 asked Jun 28, 2019
655 views
Explain why the worst-case running time for bucket sort is $\Theta(n^2)$. What simple change to the algorithm preserves its linear average-case running time and makes its...