Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged countingsort
0
votes
2
answers
1
Cormen Edition 3 Exercise 8.2 Question 4 (Page No. 197)
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 into the range $[a..b]$ in $O(1)$ time.Your algorithm should use $\Theta(n+k)$ preprocessing time.
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 into the ...
akash.dinkar12
1.6k
views
akash.dinkar12
asked
Jun 28, 2019
Algorithms
cormen
algorithms
sorting
countingsort
descriptive
+
–
0
votes
0
answers
2
Cormen Edition 3 Exercise 8.2 Question 3 (Page No. 196)
Suppose that we were to rewrite the for loop header in line $10$ of the COUNTINGSORT as 10 for j = 1 to A.length Show that the algorithm still works properly. Is the modified algorithm stable?
Suppose that we were to rewrite the for loop header in line $10$ of the COUNTINGSORT as 10 for j = 1 to A.lengthShow that the algorithm still works properly. Is the modif...
akash.dinkar12
362
views
akash.dinkar12
asked
Jun 28, 2019
Algorithms
cormen
algorithms
sorting
countingsort
descriptive
+
–
0
votes
1
answer
3
Cormen Edition 3 Exercise 8.2 Question 2 (Page No. 196)
Prove that COUNTING-SORT is stable.
Prove that COUNTING-SORT is stable.
akash.dinkar12
386
views
akash.dinkar12
asked
Jun 28, 2019
Algorithms
cormen
algorithms
sorting
countingsort
descriptive
+
–
0
votes
0
answers
4
Cormen Edition 3 Exercise 8.2 Question 1 (Page No. 196)
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[i] now contains the number of elements equal to i . 7 for i =1 to k 8 C[i] = C[ ... j] 12 C[A[j]] = C[A[j]] - 1 illustrate the operation of COUNTING-SORT on the array $A=\langle 6,0,2,0,1,3,4,6,1,3,2 \rangle $
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[i] now contains the number of el...
akash.dinkar12
355
views
akash.dinkar12
asked
Jun 28, 2019
Algorithms
cormen
algorithms
sorting
countingsort
descriptive
+
–
To see more, click for the
full list of questions
or
popular tags
.
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register