{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# FinalReview - CMPS 101 Final Review Problems 1 Let T be a...

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

CMPS 101 Final Review Problems 1. Let T be a binary tree, and let ) ( T n and ) ( T h denote its number of nodes and height, respectively. Show that )) ( lg( ) ( T n T h . (Hint: this was proved in the solutions to hw6.) 2. Trace HeapSort on the following arrays a. (9, 3, 5, 4, 8, 2, 5, 10, 12, 2, 7, 4) b. (5, 3, 7, 1, 10, 12, 19, 24, 5, 7, 2, 6) c. (9, 8, 7, 6, 5, 4, 3, 2, 1) 3. Draw the Binary Search Tree resulting from inserting the keys: 5 8 3 4 6 1 9 2 7 (in that order) into an initially empty tree. Write pseudo-code for the following recursive algorithms, and write their output when run on this tree. a. InOrderTreeWalk() b. PreOrderTreeWalk() c. PostOrderTreeWalk() Note: Some of the topics represented by the following problems my not be covered by end of business Tuesday 8/11/09. If that is the case, those topics will not appear on the final exam. 4. The predecessor of a node x in a Binary Search Tree is defined to be the node which is printed immediately before x in an InOrderTreeWalk(). Let T be a Binary Search Tree and let x be a node in T . Suppose x has no left child, and x has a predecessor
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern