This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Assignment #3, CS/531 Due Date: Monday, Oct. 24, 2011 Total points: 47 • You MUST turn in your HW by 2:10pm on Oct 21. After that, I will NOT accept your HW. This rule will be STRICTLY ENFORCED. • Please PRINT YOUR LAST NAME, FIRST NAME and UB number on the first page. • Write solution of each problem on a separate sheet. Staple them in the order of problem numbers. • If your homework solution deviates significantly from these guidelines, TA may deduct up to 20% of the points. • UNSUPPORTED SOLUTIONS RECEIVE NO CREDIT. 1. (2+6 = 8 pts) A local tennis club is going to have a tournament to decide the 1st and the 2nd place player among n players. The tournament is by elimination. Namely, when two players play a match, the loser will be dropped from the competition. (To make it simpler, we assume n is a power of 2, and no ties in any match). It is easy to see that n- 1 matches are necessary and sufficient to decide the 1st place player. The harder question is how many additional matches are needed to decide the 2nd place player. (a) Describe how to decide the first place player using n- 1 matches. (b) Describe how to decide the second place player using additional O (log n ) matches. Another description of the problem: We are given an unsorted array A [1 ..n ] of numbers. (a) Find the largest element in A using n- 1 comparisons. (b) Then, find the second largest element in A using additional O (log n ) comparisons. 2. (7 pts) LCS problem re-visited. Let A and B be two strings of length m and n respectively. The LCS algorithm finds the length l of the longest common subsequence C of A and B . As discussed in class, C is not unique. Namely, there might be more than one common subsequences of A and B with length l ....
View Full Document
- Fall '11