ADT Binary Search tree: A binary search tree can be used to store a list of comparable objects. In a generic binary search tree class, constrain E(the type parameter) to be the class types that implement Comparable interface. In the class header, add the interface as the upper bound to E. public class BinarySearchTree> Specifications of the ADT binary search tree: • Construct a binary search tree. • Retrieve the root of this tree. • Change the root of this tree if supported. • Check if this tree is empty. • Make this tree empty. • Search an element in this tree. • Insert an element into this tree. • Delete an element from this tree. • Construct an iterator of this tree. • Get a reference to the element of a node. You should design these operations in bold in a super class and put the rest in a sub class. To support this class, the following classes must be designed and implemented: • Generic tree node class: a tree node contains an element, a left reference, and a right reference. • Generic tree iterator class: a class implementing Iterator interface and provides traversal operations. • Tree exception class: used for the abnormal situations from some tree operations.
Java coding
ADT Binary Search tree:
A binary search tree can be used to store a list of comparable objects. In a generic binary search tree class, constrain E(the type parameter) to be the class types that implement Comparable interface. In the class header, add the interface as the upper bound to E.
public class BinarySearchTree<E extends Comparable<E>>
Specifications of the ADT binary search tree:
• Construct a binary search tree.
• Retrieve the root of this tree.
• Change the root of this tree if supported.
• Check if this tree is empty.
• Make this tree empty.
• Search an element in this tree.
• Insert an element into this tree.
• Delete an element from this tree.
• Construct an iterator of this tree.
• Get a reference to the element of a node.
You should design these operations in bold in a super class and put the rest in a sub class. To support this class, the following classes must be designed and implemented:
• Generic tree node class: a tree node contains an element, a left reference, and a right reference.
• Generic tree iterator class: a class implementing Iterator interface and provides traversal operations.
• Tree exception class: used for the abnormal situations from some tree operations.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps