Question
In java, create class BNode(T), which implements the interface TreeNode(T) interface methods: void setRight(TreeNode(T) right) - sets right side of node, where right is the
In java, create class BNode(T), which implements the interface TreeNode(T)
interface methods:
void setRight(TreeNode(T) right) - sets right side of node, where right is the node to the right of this node
void setRight(TreeNode(T) left) - sets left side of node, where left is the node to the left of this node
TreeNode getRight() - gets the right node
TreeNode getLeft() - gets the left node
T getData() - gets the data within the node
THEN, create class BT(E), which implements the Tree(E) interface, which has the following methods. Use comparator:
void clear() - clears tree of all elements
boolean contains(E e) - true if the whole tree contains given element
E first() - returns lowest tree element
E last() - returns highest tree element
boolean add(E element) - inserts element into tree
boolean empty() - checks if whole tree is empty
int size() - returns number of tree elements
E lower(E e) - returns element directly lower than given element
E higher(E e) - returns element directly higher than given element
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