A menu driven program that implements a simple BST-based database.

computer science

Description

Write a menu-driven program that implements a simple BST-based database.

The program reads data from a text file and inserts them into the BST. Once the tree has been built, present the user with a menu:

T – Print tree as an indented list (show level numbers)// see below
S – Search by a unique key (student ID)
B – Tree Breadth-First Traversal: Print by level (Use the CIS22C queue library, no STL please)
Q – Quit.
2. Recursive Depth-First Traversals
4. Print Tree
5. Find and Print Longest Branch
8. Destroy Tree
9. main()
            2. 70
3800 Lee, Victor; 2.8
3000 Brown, Joanne; 4.0
3500 Marcus, John; 3.2
1900 Walljasper, Bryan; 3.9
4300 Trapp, Amanda Elizabeth; 4.0
2100 Andrews, Dennis; 2.9
3900 Brown, Joanne; 3.5
5000 Lee, Lucy Marie; 3.4
2800 Brown, Joanne; 2.6
4200 Brown, Joanne; 4.0
3300 Lee, Victor; 3.6
1500 Marcus, John; 4.0
2500 Lee, Mary; 3.8

D – Depth-First Traversals: inorder, preorder, postorder

I – Iterative Depth-First Traversals: inorder, preorder, postorder (use a stack)  (Use the CIS22C stack library, no STL please)

R – Find the longest branch and print it (from leaf to root) // See class example.

A – This is a hidden option. When chosen, display the name of the developer.

H – Help – to show the menu, and

Provide at least one test case for each option, except for search, for which provide more test cases. Send the output to the screen. When done, copy and paste it to BST_Output.txt.

Grading:

1. Build BST

3. Breadth-First Traversal

7. Search BST

Binary Tree (With 50 As the Root):

                          50

        20                               70

10            40               60            80


A print tree as an indented list

1. 50

                        3. 80

                        3. 60

            2. 20

                        3. 40

                        3. 10

Input File: gpa.txt (see next page).

To test your program create an input file using the data shown below and name it gpa.txt:

Instruction Files

Related Questions in computer science category