hw5 soln

hw5 soln - Winter 2009 CS 32 Homework 5 Solution Problem 1...

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

Winter 2009 CS 32 Homework 5 Solution Problem 1 Problem 3 Problem 2 Problem 4 Problem 1: a. 50 b. c. 20 60 d. e. 10 40 70 f. g. 30 45 65 80 h. i. 25 35 75 j. k. One possibility is l. 50 m. n. 25 60 o. p. 10 40 70 q. r. 35 45 65 80 s. t. 75 Other possibilities have the left subtree of 50 being 10 40 35 45 25 or 10 40 25 45 35 u. In-order: 10 20 25 30 35 40 45 50 60 65 70 75 80 v. Pre-order: 50 20 10 40 30 25 35 45 60 70 65 80 75 w. Post-order: 10 25 35 30 45 40 20 65 75 80 70 60 50 x. Problem 2: a. 6

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

View Full Document
b. c. 3 5 d. e. 1 2 4 f. g. 6 3 5 1 2 4 h. i. 5 3 4 1 2 j. Problem 3: a. struct Node b. { c. int data; d. Node* left; e. Node* right; f. Node* parent; g. }; h. i. j. { k. if (n == NULL) l. set n to point to a new Node whose data field is set to value, m. whose left and right children are NULL, and whose parent
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/24/2012 for the course CS CS 32 taught by Professor Mojavi during the Spring '08 term at UCLA.

Page1 / 3

hw5 soln - Winter 2009 CS 32 Homework 5 Solution Problem 1...

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

View Full Document
Ask a homework question - tutors are online