Professional Documents
Culture Documents
Assignment # 2
Due: Tuesday, Oct 05 in class
Problem 2.1
Problem 2.2
Can you sort n integers in the range 0 to 2n in Θ(n) time? If yes, give an algorithm. If not,
why not?
Problem 2.3
Show that the second smallest of n elements can be found with n +┌ lgn ┐ - 2
comparisons in the worst case. You are not allowed to use heaps or any sorting
procedure. Come up with a selection algorithm based on tournament method. Give details
and justification.