Question: We say that a binary tree T is perfectly balanced if, for each node n in T , the number of keys in the left
We say that a binary tree T is perfectly balanced if, for each node n in T , the number of keys in the left and right subtrees of n differ at most by 1. Write an algorithm called Is-Perfectly-Balanced that, given a binary tree T returns true if T is perfectly balanced, and false otherwise. Also, analyze the complexity of Is-Perfectly-Balanced.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
