{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Test2Solution - COP 3530 Data Structures and Algorithms...

Info icon This 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 -
Image of page 1

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

View Full Document Right Arrow Icon
COP 3530 Data Structures and Algorithms Summer 2007 Name: ______________________ Question 1: ____ / ____ Question 2: ____ / ____ Question 3: ____ / ____ Question 4: ____ / ____ Total Score: ____ / ____ - 2 -
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 -
Image of page 3

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

View Full Document Right 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
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.
Image of page 5

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern