Consider this array A, which contains 10 three-digit integers: [365, 943, 345, 461, 154, 761, 145, 171,
Question:
Consider this array A, which contains 10 three-digit integers:
[365, 943, 345, 461, 154, 761, 145, 171, 855, 243]
A is sorted twice with the counting sort algorithm. During the first pass, A is sorted according to each number's last digit, and the resulting array is copied back into A. During the second pass, A is sorted according to each number's second digit, and the resulting array is copied back into A.
a) After the two counting sort passes, what is A[0]?
b) After the two counting sort passes, what is A[1]?
c) After the two counting sort passes, what is A[2]?
d) After the two counting sort passes, what is A[3]?
e) After the two counting sort passes, what is A[4]?
f) After the two counting sort passes, what is A[5]?
g) After the two counting sort passes, what is A[6]?
h) After the two counting sort passes, what is A[7]?
i) After the two counting sort passes, what is A[8]?
j) After the two counting sort passes, what is A[9]?
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest