Clicker Questions - 23-Trees
Clicker Questions
Below are four trees:
Tree-1
|
Tree-2
|
Tree-3
|
Tree-4
|
Each question has an answer which is one letter.
Question 1: About which node do we rotate to turn Tree-1 into Tree-2?
Answer
For this and the next two question, you look for code who swaps parent-child relationship from the first tree to the second tree. The answer is the node that we was the child. In the his I.
Question 2: About which node do we rotate to turn Tree-1 into Tree-3?
Answer
G.
Question 3: About which node do we rotate to turn Tree-1 into Tree-4?
Answer
O.
Question 4: Tree-2 is not an AVL tree. Name a node that is imbalanced.
Answer
I: Its left subtree has a height of 3, and its right subtree has a height of 1. All other nodes are balanced.
Question 5: Tree-3 is not an AVL tree. Name a node that is imbalanced.
Answer
G: Its left subtree has a height of 0, and its right subtree has a height of 2. All other nodes are balanced.
Question 6: Tree-4 is not an AVL tree. Name a node that is imbalanced.
Answer
O: Its left subtree has a height of 0, and its right subtree has a height of 3. All other nodes are balanced.
Class Stats, PDF Download