Question: You can write code or psuedocode. Binary search trees and AVL trees are declared as follows: class BST { class Entry { T element; Entry
You can write code or psuedocode. Binary search trees and AVL trees are declared as follows: class BST{ class Entry { T element; Entry left, right; } Entry root; // root node of BST int size; // number of elements in tree } class AVL extends BST { class Entry extends BST.Entry { int height; } } Assume that both classes have been implemented. Write a method of the AVL class that verifies if the tree is a valid AVL tree, that satisfies all conditions of BST, and the balancing conditions of AVL trees. In addition, do not trust the height value stored at the nodes, and heights of nodes have to be verified to be correct. Make your code as efficient as possible. State the running time of your algorithm. boolean verify() { /* To do */ }
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
