Given Binary Search Tree Adt Implementation Extend Implementation Adding Five Operations L Q37077729

Given a binary search tree ADT implementation, extend theimplementation by adding the five operations listed below. Note:your method declarations must exactly match the declarationsshown.

public BSTNode<T> getRoot()
Return a reference to the root of the tree.

public T getMax()
Return the largest element in the tree. If the tree is empty,return null.

public int leafCount()
Return the number of leaf nodes in the tree.

public int onlyChildCount()
Return the number nodes in the tree that have exactly one childnode.

public boolean similarTree(BinarySearchTree other)
Given a reference to another tree as a parameter, return true ifthe two trees have the same shape, otherwise return false. That is,return true if the tree

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.