Step 1 The Binary Tree Class using the lecture material as a guide create a bina
ID: 3812483 • Letter: S
Question
Step 1 The Binary Tree Class using the lecture material as a guide create a binary tree class. Thisclass should be generic so that it will operate on any given type. Your class should have the following functionality: insert Insert a node into the proper location of the tree remove Remove a specific node from the tree contains Report is the tree contains a specific piece of data findMin Find and return the smallest value in the tree findMax Find and return the largest value in the tree isEmpty Determine if the tree is empty print Tree visit each node in the tree and print the data to the screenExplanation / Answer
Step 1 :-
// Insert method is avaiable
public void printTree(Node root){
if(root != null){
System.out.println(root.data);
if(root.left != null){
printTree(root.left);
if(root.right != null){
printTree(root.right);
}
}
}
}
public boolean isTreeEmpty(Node root){
if(root != null){return true;}
else return false;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.