Question: Please finish everything marked TODO. BST.java import java.util.ArrayList; import java.util.Collection; import java.util.List; public class BST implements Tree { private int height; private int size; private
Please finish everything marked TODO.
BST.java
import java.util.ArrayList; import java.util.Collection; import java.util.List;
public class BST
private int height; private int size; private BinaryNode
public BST(){ this.root = null; this.height = 0; this.size = 0; }
// TODO: BST public BST(BinaryNode
// Access field public BinaryNode
// Basic properties public int height() { return this.height; } public int size() { return this.size; } public boolean isBalanced() { return root.isBalanced(); }
// TODO: updateHeight - Update the root height to reflect any changes public void updateHeight() { }
// Traversals that return lists // TODO: Preorder traversal public List
// TODO: Inorder traversal public List
// TODO: Postorder traversal public List
// Helpers for BST/AVL methods // TODO: extractRightMost // This will be called on the left subtree and will get the maximum value. public BinaryNode
// AVL & BST Search & insert same // TODO: search public BinaryNode
// TODO: insert public void insert(E elem) {
}
// TODO: delete public BinaryNode
// Stuff to help you debug if you want // Can ignore or use to see if it works. static
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
