# YOU CAN DOWNLOAD 200+ SUBJECTS PDF BOOK FOR COMPETITIVE EXAMINATIONS

## Data Structure Questions and Answers-AVL Tree

Question 1 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER] |

What is an AVL tree?

a tree which is balanced and is a height balanced tree | |

a tree which is unbalanced and is a height balanced tree | |

a tree with three children | |

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?

to avoid formation of skew trees | |

to save memory | |

to attain faster memory access | |

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?

only i | |

only i and ii | |

only ii | |

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?

p | |

log(p) | |

log(p)/2 | |

^{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?

true | |

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.