383 views

Please log in or register to answer this question.

Related questions

405
views
1 answers
0 votes
akash.dinkar12 asked Jun 28, 2019
405 views
Prove that COUNTING-SORT is stable.
375
views
0 answers
0 votes
akash.dinkar12 asked Jun 28, 2019
375 views
COUNTING-SORT(A, B, k) 1 let C[0, ,k] be a new array 2 for i = 0 to k 3 C[i] = 0 4 for j = 1 to A.length 5 C[A[j]] = C[A[j]] + 1 6 // C ... - 1illustrate the operation of COUNTING-SORT on the array $A=\langle 6,0,2,0,1,3,4,6,1,3,2 \rangle $
1.7k
views
2 answers
0 votes
akash.dinkar12 asked Jun 28, 2019
1,726 views
Describe an algorithm that, given $n$ integers in the range $0$ to $k$ preprocesses its input and then answers any query about how many of the $n$ integers fall ... in $O(1)$ time.Your algorithm should use $\Theta(n+k)$ preprocessing time.
737
views
1 answers
1 votes
akash.dinkar12 asked Jun 28, 2019
737 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 worst-case running time $O(n\ lg\ n)$?