HW4 - ECE 242 Homework 4 Total: 100pts There are 3...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
ECE 242 Homework 4 Total: 100pts There are 3 questions . Please submit your responses, screen shots, tables, and methods in a Word document with the filename following the convention <FirstName>_<LastName>_HW4.doc by the deadline specified ( or suffer the wrath of the grader ). Question 1 [40 points] (3 parts): The following question will deal with the above diagram. All the nodes in the Binary tree are defined with the following class: class Node { public Node Right; public Node Left; public int Key; public String Value; } You can assume that any values inserted into the tree are unique and duplicates will never exist. a) Write a method that will compress the tree into an array of integers. After compression, the contents of your array should be the following: 1, 2, 5, 6, 7, 8. [15] b) Write a method called ' reset ' that will go through every node in the tree and set the Value to be null.[15] c) Write a method that will calculate the number of leaves for a given tree. [10] Question 2 [35 points] (5 parts):
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/20/2010 for the course ENGINEERIN 242 211 taught by Professor Tessier during the Spring '10 term at UMass (Amherst).

Page1 / 2

HW4 - ECE 242 Homework 4 Total: 100pts There are 3...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online