# Data Structure Questions and Answers-AVL Tree

## Data Structure Questions and Answers-AVL Tree

 Question 1 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What is an AVL tree?
 A a tree which is balanced and is a height balanced tree B a tree which is unbalanced and is a height balanced tree C a tree with three children D a tree with atmost 3 children
Question 1 Explanation:
It is a self balancing tree with height difference atmost 1.

 Question 2 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Why we need to a binary tree which is height balanced?
 A to avoid formation of skew trees B to save memory C to attain faster memory access D to simplify storing
Question 2 Explanation:
In real world dealing with random values is often not possible, the probability that u are dealing with non random values(like sequential) leads to mostly skew trees, which leads to worst case. hence we make height balance by rotations.

 Question 3 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the below diagram is following AVL tree property?
 A only i B only i and ii C only ii D none of the mentioned
Question 3 Explanation:
The property of AVL tree is it is height balanced tree with difference of atmost 1 between left and right subtrees.

 Question 4 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What is the maximum height of an AVL tree with p nodes?
 A p B log(p) C log(p)/2 D p⁄2
Question 4 Explanation:
Consider height of tree to be 'he', then number of nodes which totals to p can be written in terms of height as N(he)=N(he-1)+1+N(he-2). since N(he) which is p can be written in terms of height as the beside recurrence relation which on solving gives N(he)= O(logp) as worst case height.

 Question 5 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
To restore the AVL property after inserting a element, we start at the insertion point and move towards root of that tree. is this statement true?
 A true B false
Question 5 Explanation:
It is interesting to note that after insertion, only the path from that point to node or only that subtrees are imbalanced interms of height.

There are 5 questions to complete.