Question: Question II ( 2 5 points ) : Implement in BinaryTree class the following methods: a ) public int longestPathTwoLeaves ( ) to return the
Question II points: Implement in BinaryTree class the following methods:
a public int longestPathTwoLeaves to return the length of the longest path between two leaves. Hint: use the height method
b public void maxValueInEachLevel to print the largest value in each level. Hint keep track of nodes level
c public int sizeRightSubtreeBTNode v to find the size of the right subtree of a node v
d public void deleteNodesint x to delete all nodes whose keys are larger than x
e public void deleteAllLeaves to delete all leaves from a binary tree.
Question III points: Implement the following Boolean methods in BinaryTree class to test whether a binary tree is
a a binary search tree. Header: public boolean isBinarySearchTree
b a max heap. Header: public boolean isMaxHeapTree
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
