Test2Solution - COP 3530 Data Structures and Algorithms...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
COP 3530 Data Structures and Algorithms Summer 2007 Name: ______________________ Test 2 Solution Your work is to be done individually without the aid of the text or notes. The exam is worth 100 points and it has 4 questions. You must answer all exam questions. You will have seventy-five (75) minutes to complete the exam once you may start answering questions. Have your ID out and ready to present when submitting your exam. Any questions should be directed to the exam proctors. Please use both sides of the paper when answering questions. If you need additional paper, please ask an exam proctor. By taking this exam you are agreeing to the following statement: “On my honor, I have neither given nor received unauthorized aid in doing this assignment.” Good luck! - 1 -
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COP 3530 Data Structures and Algorithms Summer 2007 Name: ______________________ Question 1: ____ / ____ Question 2: ____ / ____ Question 3: ____ / ____ Question 4: ____ / ____ Total Score: ____ / ____ - 2 -
Background image of page 2
COP 3530 Data Structures and Algorithms Summer 2007 Name: ______________________ 1. Let the following array of elements [3, 4, 8, 2, 6, 9, 5, 1, 3, 6, 4, 7] represent the elements in a tree. Answer the following questions regarding this array. (a) [10] Initialize a Min Height-Biased Leftist Tree from the array above. Show each step of the initialization process by showing the contents of the queue at each step. (b) [5] Perform three removeMax() operations on the HBLT. Show the resulting tree after each operation. (c) [5] What is the complexity of the initialize and removeMax methods? Justify your answer. - 3 -
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COP 3530 Data Structures and Algorithms Summer 2007 Name: ______________________ (a) For the sake of space, all steps are not shown. To initialize an HBLT you start with n one node trees and put them in a queue. You continue to remove two trees, meld them, and re-insert them into the queue until only one tree remains. Shown below is the queue after each complete pass through the elements it contains. - 4 - 3 Pass 1 4 8 2 6 9 5 1 3 6 4 7 3 Pass 2 4 2 8 6 9 1 5 3 6 4 7 2 Pass 3 8 3 4 1 5 6 9 3 6 4 7 3 Pass 4 4 6 9 1 2 5 8 3 6 4 7 3 Pass 5 (Final Tree) 4 6 9 1 2 7 8 3 4 6 5
Background image of page 4
COP 3530 Data Structures and Algorithms Summer 2007 Name: ______________________ (b) To remove the min, break off the two children as trees and meld them together to get the new tree. - 5 -
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/02/2009 for the course EEL 3472 taught by Professor Rakov during the Spring '08 term at University of Florida.

Page1 / 13

Test2Solution - COP 3530 Data Structures and Algorithms...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online