Question
Binary Search Tree in JAVA with a driver class that uses the methods Implement the BinarySearchTree class. The BinarySearchTree class extends the BinaryTree class which
Binary Search Tree in JAVA with a driver class that uses the methods
Implement the BinarySearchTree class. The BinarySearchTree class extends the BinaryTree class which implements the Tree interface. All can be seen here. Your assignment is to implement all of the abstract methods of the BinaryTree class recursively.
They are:
Insert.
Iterator (non-recursive).
Remove.
Search.
You must also implement an Iterator inner class for the BinarySearchTree class. You must submit a modified BinarySearchTree.java file with your source code.
Do not submit and do not modify the Tree.java or BinaryTree.java files.
/* * * Tree.java * */ public interface Treeextends Iterable { void insert(E data); void remove(E key); boolean search(E key); } /* * * BinaryTree.java * */ public abstract class BinaryTree implements Tree { protected class Node { protected Node(T data) { this.data = data; } protected T data; protected Node left; protected Node right; } protected Node root; } /* * * BinarySearchTree.java * */ import java.util.Iterator; public class BinarySearchTree > extends BinaryTree { public void insert(E data) { return; } public Iterator iterator() { return null; } public void remove(E key) { return; } public boolean search(E key) { return false; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started