BinarySearchTreeADT.java 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. * BinarySearchTreeADT defines the interface to a binary search tree.
  3. *
  4. * @author Dr. Lewis
  5. * @author Dr. Chase
  6. * @version 1.0, 8/19/08
  7. */
  8. public interface BinarySearchTreeADT<T> extends BinaryTreeADT<T> {
  9. /**
  10. * Adds the specified element to the proper location in this tree.
  11. *
  12. * @param element the element to be added to this tree
  13. */
  14. public void addElement (Node<T> element);
  15. /**
  16. * Removes and returns the specified element from this tree.
  17. *
  18. * @param targetElement the element to be removed from this tree
  19. * @return the element removed from this tree
  20. */
  21. public T removeElement (T targetElement);
  22. /**
  23. * Removes all occurences of the specified element from this tree.
  24. *
  25. * @param targetElement the element that the list will have all instances
  26. * of it removed
  27. */
  28. public void removeAllOccurrences (T targetElement);
  29. /**
  30. * Removes and returns the smallest element from this tree.
  31. *
  32. * @return the smallest element from this tree.
  33. */
  34. public T removeMin();
  35. /**
  36. * Removes and returns the largest element from this tree.
  37. *
  38. * @return the largest element from this tree
  39. */
  40. public T removeMax();
  41. /**
  42. * Returns a reference to the smallest element in this tree.
  43. *
  44. * @return a reference to the smallest element in this tree
  45. */
  46. public T findMin();
  47. /**
  48. * Returns a reference to the largest element in this tree.
  49. *
  50. * @return a reference to the largest element in this tree
  51. */
  52. public T findMax();
  53. }