Binary Tree - Data Structures I - Homework 7 | COMP 385, Assignments of Data Structures and Algorithms

Material Type: Assignment; Class: DATA STRUCTURES II; Subject: Computer Science; University: Wentworth Institute of Technology; Term: Fall 2007;

Typology: Assignments

Pre 2010

Uploaded on 08/19/2009

koofers-user-2hx
koofers-user-2hx 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Wentworth Institute of Technology
Division of Professional and Continuing Studies
COMP385 Section 71 - Data Structures II - Fall, 2007
Homework 7 – Binary Tree
Instructor: Bob Goldstein (617) 912-2512
http://home.comcast.net/~goldsteinr/Courses/index.html
http://goldstein.eri.harvard.edu/courses/index.html
http://myweb.wit.edu/goldsteinr/Courses/index.html
Due Date: November 6, 2007
Hand In: Printout of program code and dialogue of how it runs.
Purpose:
Build a simulation by working with binary trees.
Description:
This project is to fill a binary tree with records consisting of the Reservations that you did in Homework number 1.
Start with the program we reviewed in class. However, change the TreeItem to be a Reservation class.
Construct TWO different binary trees, one with the key as the person item of the Reservation’s
LastName_FirstName (separated by an underscore, all converted to upper case). The other should have as the key
the reservationID.
Write code to populate the trees with 1000 randomly generated reservations.
Add code to the BTree class to UPDATE the dayOfArrival
Make a version of the In-Order traversal Print command that can prints only a section of the tree. This
helps with debugging. Print out sections of both trees, one ordered by the LastName_Firstname key and
the other ordered by the reservationID key.
Alter the Find method of BTree so that you can puts the level number of the last found item into a private
variable of the BTree class that you can access with a call to theTree.getLevelOfLastFoundItem()
Revise the ConsoleDraw code so that it prints out only a specified number of levels of the tree. This way,
you can print from the middle of a large tree to examine it.
Demonstrate, that when one of the trees are updated, the other tree automatically reflects this change. Use
the alternate version of In-order traversal that you wrote above to demonstrate this.
/app/work/qkd80l-459218-2765072-homework7-doc.doc 1 12/5/2020 12/5/2020

Partial preview of the text

Download Binary Tree - Data Structures I - Homework 7 | COMP 385 and more Assignments Data Structures and Algorithms in PDF only on Docsity!

Wentworth Institute of Technology

Division of Professional and Continuing Studies

COMP385 Section 71 - Data Structures II - Fall, 2007

Homework 7 – Binary Tree

Instructor: Bob Goldstein (617) 912- [email protected] [email protected] http://home.comcast.net/~goldsteinr/Courses/index.html http://goldstein.eri.harvard.edu/courses/index.html http://myweb.wit.edu/goldsteinr/Courses/index.html Due Date: November 6, 2007 Hand In: Printout of program code and dialogue of how it runs. Purpose: Build a simulation by working with binary trees. Description: This project is to fill a binary tree with records consisting of the Reservations that you did in Homework number 1. Start with the program we reviewed in class. However, change the TreeItem to be a Reservation class. Construct TWO different binary trees, one with the key as the person item of the Reservation’s LastName_FirstName (separated by an underscore, all converted to upper case). The other should have as the key the reservationID.  Write code to populate the trees with 1000 randomly generated reservations.  Add code to the BTree class to UPDATE the dayOfArrival  Make a version of the In-Order traversal Print command that can prints only a section of the tree. This helps with debugging. Print out sections of both trees, one ordered by the LastName_Firstname key and the other ordered by the reservationID key.  Alter the Find method of BTree so that you can puts the level number of the last found item into a private variable of the BTree class that you can access with a call to theTree.getLevelOfLastFoundItem()  Revise the ConsoleDraw code so that it prints out only a specified number of levels of the tree. This way, you can print from the middle of a large tree to examine it.  Demonstrate, that when one of the trees are updated, the other tree automatically reflects this change. Use the alternate version of In-order traversal that you wrote above to demonstrate this. /app/work/qkd80l-459218-2765072-homework7-doc.doc 1 12/5/2020 12/5/