This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Data Structures and Algorithms II Summer 2010 Takehome Test Name: __________________________________________________________________ Email: _________________________________________________________________ This is an openbook, opennotes test. You may also search for related topics and read more about them, but you may not ask anyone questions (or post questions to a forum) while taking the test. You will have approximately 24 hours to take the test. The time that the test is due will be specified in the email that includes the test as an attachment. You must email the completed test to me at [email protected] You may print out the test, do it on paper, scan it, and send it; or, do it electronically (but that might be difficult for some questions). You may use scrap paper, of course, but do not scan or send that to me. (1) Answer the following questions about binary heaps: (a) Show the result of inserting the values 80, 26, 40, 37, 96, 17, 32, 99, 21, one at a time, into an initially empty binary heap. (Assume that the binary heap supports the deleteMin operation, not the deleteMax operation.) Draw the resulting tree ; you do not have to draw the trees that result along the way. (b) Show the result of using the guaranteed lineartime algorithm discussed in the textbook (buildHeap) to build a binary heap using the same input. Assume that you start by inserting the data into the array representation of the heap in the order specified in part (a). (c) Show the resulting trees after each of three deleteMin operations is applied to each of the binary heap from part (a). In other words, starting with the resulting heap from part (a), show the result after 1 deleteMin operation, after 2 deleteMin operations, and after 3 deleteMin operations. (2) Consider the following leftist heaps: Leftist heap A: Leftist heap B: (a) Label each node in both of the given leftist heaps with its null path length. Use the conventions discussed in our text book. You may write the null path length next to each node in the figures on the previous page....
View
Full Document
 Spring '08
 Faculty
 Computational complexity theory, NPcomplete, null path length, leftist heap

Click to edit the document details