Lab Goal : This lab was designed to teach you more about Binary Trees. Lab Description : Write
Lab Goal :
Java – Binary Tree. Will leave an upvote.
This lab was designed to teach you more about Binary Trees. Lab Description : Write a binary search tree class. For the base lab, you must write the following methods :: preOrder, postOrder, inOrder, revOrder, getNumLeaves, getNumLevels, getWidth, getHeight, getNum Nodes, toString, is Full. The following method groups are extra credit. Each group will net you an extra ten points on your base 100 point lab grade. You can complete any or all of the options in any order you prefer. Complete as many of these options as you can. Group 1 :: write a method to search the tree for a value and return true or false Group 2 :: write getLargest and getSmallest methods to return the smallest and largest tree values Group 3 :: write a level order traversal using the Java LinkedList as a Queue Group 4 :: write a method to remove a node from the tree – must be recursive Group 5 :: write a method to display the tree like a tree-level order traversal might be useful Sample Output : IN ORDER 70 80 85 90 98 100 120 ROOT 90 80 100 70 85 98 120 PRE ORDER 90 80 70 85 100 98 120 POST ORDER 70 85 80 98 120 100 90 height = 2 width = 5 numLevels = 3 numLeaves = 4 numNodes = 7 isFullTree = true REVERSE ORDER 120 100 98 90 85 80 70 Tree height is 2 Tree width is 5 Number of leaves is 4 Number of nodes is 7 Number of levels is 3 Tree as a string 70 80 85 90 98 The tree is full. 100 120 © A+ Computer Science –Binary Trees – www.apluscompsci.com BONUS SECTION The tree contains 100! The does not contain 114! The smallest tree node 70 The largest tree node 120 Tree before removing any nodes – using level order traversal. 90 80 100 70 85 98 120 Tree after removing 90. 98 80 100 70 85 120 Tree after removing 70. 98 80 100 85 120 Tree after removing 85. 98 80 100 120 Tree after removing 98. 100 80 120 Tree after removing 80. 100 120 Tree after removing 120. 100 Tree after removing 100.
We've got everything to become your favourite writing service
Money back guarantee
Your money is safe. If we fail to satisfy your expectations, you can always request a refund and get your money back.
Confidentiality
We don’t share your private information with anyone. What happens on our website stays on our website.
Our service is legit
We provide you with a sample paper on the topic you need, and this kind of academic assistance is perfectly legitimate.
Get a plagiarism-free paper
We check every paper with our plagiarism-detection software, so you get a unique paper written for your particular purposes.
We can help with urgent tasks
Need a paper tomorrow? We can write it even while you’re sleeping. Place an order now and get your paper in 8 hours.
Pay a fair price
Our prices depend on urgency and level of study. If you want a cheap essay, place your order with as much time as possible. Our prices start from $11 per page.