Question: In your Lab 6 _ Driver dass, create a static tree instance and buld a simple tree of names that is similar in structure (

In your Lab6_Driver dass, create a static tree instance and buld a simple tree of names that is similar in structure (but not cantent) to the followine tree. That is, the tree contals is names. You must use vald names of your choice instead of the letters.
Include the following static methods in your Lab6_Driver:
all Deacendants that takes a node/position as parameter and recursively displays all the descendants of that position.
Note how the children () method returns an Iterable: you should use this to traverse through the list of children of a node and recursively display their children.
For example, using the node ramed C above, the method display:
F. G, J, K
Illustrate this method by displaying of the deicendants of the root node. lllustrate this method by dieplaying ait the descendants of the right child of the root node. You must use the right!) method in this.
pathroroot that display the path from any given node/position to the coot of the tree.
Think of this as a position being traverged through the path to get from the position to the root and consider how we've traversed through a Inted list from the first to last.
For example, for the given tree, the following shows the path from the node H upwards to the root:
Perk-from H to root (A)=B,D,B,A
Illustrate this method by displayng the path from the leftmont node at the deepest level e.s. node with H above.
4. In your Lab6_Driver, include the code to do the following:
Display the height of the tree.
Display the depth of the tree left child of the root node. You must use the left() method in this.
Aemove the node at the leftmost position of the deepest level. E.. node H above
Display the final size of the tree.
Display the output as shown below.
Sample Output
The descendants of A: ...
The descendants of C : ....
The path from H to root (A) : ...
Tree Height: ...
Depth of left child of the root (B) : ...
Removed node with: H
Final tree size: 10
Submission
Submit your Lab6. zip file that includes all the following files (Position. java, Tren. ) ava. AbstractTree.java, BinaryTree.java, AbstractBinaryTree.java,
LinkedBinaryTree.java, Lab6_Driver.java) and any other files you use via Nexus.
In your Lab 6 _ Driver dass, create a static tree

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!