A Place for Latest Exam wise Questions, Videos, Previous Year Papers, Study Stuff for MCA Examinations - NIMCET
Previous Year Question (PYQs)
3
Given below are two statements: one is labelled as Assertion A and the other is labelled as Reason R.
Assertion A: The AVL trees are more balanced as compared to Red Black trees, but they may cause more rotations during insertion and deletion.
Reason R: A Red Black tree with n nodes has height that is greater than $2\log_2(n+1)$ and the AVL tree with n nodes has height less than $\log_\phi(\sqrt{5}(n+2))-2$ where $\phi$ is golden ratio.
In the light of the above statements, choose the correct answer from the options given below.
Solution
Assertion A is true because AVL trees are more strictly balanced than Red Black trees.
Reason R is false because the height of a Red Black tree is at most $2\log_2(n+1)$, not greater than it.
Online Test Series, Information About Examination, Syllabus, Notification and More.