Using the classes and methods implemented in Lab 7 do the following: Add the following methods to class BSTree: preOder(

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Using the classes and methods implemented in Lab 7 do the following: Add the following methods to class BSTree: preOder(

Post by answerhappygod »

Using the classes and methods implemented in Lab 7 do the
following:
Add the following methods to class BSTree:
preOder()
preOrderRec(root)
Traverses and prints the contents of the tree pre-order according
to the ID.
postOder() postOrderRec(root)
Traverses and prints the contents of the tree post-order
according to the ID.
height() heightRec (root)
Returns the height of the tree.
countLeafNodes() countLeafNodesRec (root)
Returns the number of leaf nodes in the tree.
Write the expected time and space complexity as a comment at the
beginning of each method of your class.
Modify the test program form lab 7 to do the following:
Sample Output
The program can perform the following:
1- Insert Students
2- Remove a Student
3- Check if a Student Exists
4- Print inOrder
5- Print preOrder
6- Print postOrder
7- Height
8- Number of leaf nodes
9- Exit Please enter your selection:
LAB 7 CODE IS SHOWN BELOW (Please
modify!!):
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply