Question
/** * BinarySearchTreeADT defines the interface to a binary search tree. * @param */ public interface BinarySearchTreeADT extends BinaryTreeADT { /** * Adds the specified
/** * BinarySearchTreeADT defines the interface to a binary search tree. * @param
/** * Adds the specified element to the proper location in this tree. * * @param element the element to be added to this tree */ public void add(T element);
/** * Returns the smallest element in this tree without removing it. * * @return the smallest element in the tree */ public T findMin();
/** * Returns the largest element in this tree without removing it. * * @return the largest element in the tree */ public T findMax(); }
------------------------------------------------------------------------------------------
/** * BinaryTreeADT defines the interface to a binary tree data structure. * */ import java.util.Iterator;
public interface BinaryTreeADT
/** * Returns true if this binary tree is empty and false otherwise. * * @return true if this binary tree is empty */ public boolean isEmpty();
/** * Returns the number of elements in this binary tree. * * @return the integer number of elements in this tree */ public int size();
/** * Returns true if the binary tree contains an element that matches * the specified element and false otherwise. * * @param targetElement the element being sought in the tree * @return true if the tree contains the target element */ public boolean contains (T targetElement);
/** * Returns a reference to the specified element if it is found in * this binary tree. Throws an exception if the specified element * is not found. * * @param targetElement the element being sought in the tree * @return a reference to the specified element * @throws ElementNotFoundException if an element is not found */ public T find (T targetElement);
/** * Returns the string representation of the binary tree. * * @return a string representation of the binary tree */ public String toString();
/** * Performs an inorder traversal on this binary tree by calling an * overloaded, recursive inorder method that starts with the root. * * @return an iterator over the elements of this binary tree */ public Iterator
/** * Performs a preorder traversal on this binary tree by calling an * overloaded, recursive preorder method that starts with the root. * * @return an iterator over the elements of this binary tree */ public Iterator
/** * Performs a postorder traversal on this binary tree by calling an * overloaded, recursive postorder method that starts with the root. * * @return an iterator over the elements of this binary tree */ public Iterator
/** * Performs a levelorder traversal on the binary tree, using a queue. * * @return an iterator over the elements of this binary tree */ public Iterator
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