This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: HW8 Solutions Dilip Raghavan November 10, 2008 1 Section 7.2 Problem 4. Consider the amount of money given away in the tournament before the last round. This consists of two subtournaments with n 2 players each. So 2 a n 2 is given away prior to the last round. Now the subtournament won by the winner of the last round is just the whole tournament, which has n players. But we have already accounted for n 2 of them so far (as part of one of the two subtournaments prior to the final). So the winner of the last round gets 100 n 2 in the last round. So a n = 2 a n 2 + 100 n 2 = 2 a n 2 + 50 n , with the intial condition a 2 = 300 (if there are just 2 players, the winner gets 200 and the looser gets 100). By the table on page 292, the solution has the form a n = 50 n (log 2 n + A ). Problem 5. To merge 2 ordered k tuples into an ordered 2 k tuple requires 2 k 1 comparisons. So given a set of size n (where n is some power of 2), divide it into two sets of size n 2 each. Now sorting each half requires a n 2 comparisons. So a total of 2 a n 2 comparisons. Now, we have 2 ordered n 2 tuples which we would like to merge. This needs n 1 comparisons. So1 comparisons....
View
Full
Document
This note was uploaded on 09/15/2011 for the course AMAT 356 taught by Professor Hernandez/rag during the Spring '11 term at SUNY Albany.
 Spring '11
 Hernandez/Rag

Click to edit the document details