Data Structures II - Homework 7: Binary Trees Project, Assignments of Data Structures and Algorithms

A project for wentworth institute of technology's comp385 section 71 course, focusing on building simulations with binary trees. Students are required to create a person class, populate two binary trees with 1000 randomly generated people, update salaries, and implement various tree traversals and functions. The project involves working with the btree class and includes due dates, instructor information, and resources.

Typology: Assignments

Pre 2010

Uploaded on 08/18/2009

koofers-user-u2s
koofers-user-u2s 🇺🇸

9 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, 2005
Homework 7 – Binary Tree
Instructor: Bob Goldstein (617) 912-2512
http://webpages.charter.net/tlgcreations/Courses/index.html
http://goldstein.eri.harvard.edu/courses/index.html
http://public.wit.edu/~goldsteinr/index.html
Due Date: October 25, 2005
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 names, Social Security Numbers and salaries. Start
with the program we reviewed in class. However, change the TreeItem to be a Person class with private values for
SSN, salary, LastName, FirstName.
Construct TWO different binary trees, one with the key as LastName_FirstName (separated by an underscore, all
converted to upper case). The other should have as the key the salary.
Write code to populate the trees with 1000 randomly generated people.
Add code to the BTree class to UPDATE the salary field
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 Salary 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/qkdazd-419881-2765051-homework7-doc.doc 1 12/3/2020 12/3/2020

Partial preview of the text

Download Data Structures II - Homework 7: Binary Trees Project 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, 2005

Homework 7 – Binary Tree

Instructor: Bob Goldstein (617) 912- [email protected] http://webpages.charter.net/tlgcreations/Courses/index.html http://goldstein.eri.harvard.edu/courses/index.html http://public.wit.edu/~goldsteinr/index.html Due Date: October 25, 2005 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 names, Social Security Numbers and salaries. Start with the program we reviewed in class. However, change the TreeItem to be a Person class with private values for SSN, salary, LastName, FirstName. Construct TWO different binary trees, one with the key as LastName_FirstName (separated by an underscore, all converted to upper case). The other should have as the key the salary.  Write code to populate the trees with 1000 randomly generated people.  Add code to the BTree class to UPDATE the salary field  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 Salary 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/qkdazd-419881-2765051-homework7-doc.doc 1 12/3/2020 12/3/