{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

cs631hw10asolutions

cs631hw10asolutions - CS631 Homework 10a(bina ry trees...

This preview shows pages 1–3. Sign up to view the full content.

CS631 Homework 10a (binary trees) solutions Page 590, #2a pre, in and postorder traversals of tree in figure 11-44 Pre: MGDAHKLTRVUW In: ADHEKLMTRUVW Post: AHDLKGUVRWTM Page 590, #3 Given the tree in figure 11-45: a. Which node must have the inorder successor of the root? Right, then left until null – node #6 b. Give an inorder traversal of this tree (they’ve tried to make it difficult by numbering in level order). The traversal: 425616937 Page 590, #4 What binary trees are formed given insertions in these orders? a. WTNJEBA Lop-sided b. WTNABEJ Still lop-sided and O(N) for search c. ABWJNTE

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

View Full Document
Page 590, #6 Arrange A,C,E,F,L,V and Z into two trees, one with max and one with min height. Page 590, #7 Considering the binary tree in figure 11.42. a. What tree results from inserting 80, 65, 75, 45, 35 and 25, in that order? b. What happens to the resulting tree after deleting 50 and 20? 50 is just a leaf and deleted, while 20 is an internal node and we need to get the inorder predecessor or successor. The successor is a better choice in this case because the tree remains more balanced.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}