This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 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 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 internal node and we need to get the inorder predecessor or successor....
View Full Document
This note was uploaded on 10/21/2009 for the course CS CS 631 taught by Professor Dr.rogerd.eastman during the Spring '09 term at Loyola Maryland.
- Spring '09