COP5536-Exam1-solution

B 6points question3 a since we need 2 input buffers

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: . 3) If you don’t write anything, you get 0 out of 6 points. 4) If you indeed use the potential method and give the correct answer, then congratulations! You get fullmarks for this method (6 out of 6 points). Note: each method above counts for 6 points. If more than two methods are chosen, only the first two methods will be graded. Question 2 a) (8 points) Delete the root node 1; Meld its two children: subtree A rooted at 3 and subtree B rooted at 2. A B 3 2 / \ / \ 6 4 9 5 / \ / \ 12 10 18 16 / \ 22 20 Merge right tree of B with A 3 5 2 / \ / 6 4 9 / \ / \ 12 10 18 16 / \ 22 20 3 2 / \ / 6 4 9 / \ / / \ 12 10 5 18 16 / \ 22 20 Make it the right tree of B 2 / \ 9 3 / \ / \ 18 16 6 4 / \ / 12 10 5 / \ 22 20 Note: there is NO need to swap the left and right trees in the last step. b) (6 points) Question 3 a) Since we need 2 input buffers and 2 output buffers, it takes all together 4 blocks of memory, which is 800 records, as I/O buffer. Hence, there are at most 600 records left to store the loser tree that generates runs. Therefore, the max value of k is 600....
View Full Document

This note was uploaded on 11/17/2012 for the course COP 5536 taught by Professor Staff during the Spring '08 term at University of Florida.

Ask a homework question - tutors are online