Machine-translated by Google. Questions are authored in English.
Top

Discussion

AVL tree is used :

  • A.to save memory
  • B.to attain faster memory access
  • C.to avoid formation of skew trees
  • D.to simplify storing

Answer: C

An AVL tree is used to avoid formation of skew trees.

An ordinary binary search tree can become skewed, degenerating into a linked list when keys arrive in sorted order, so search takes O(n) time. An AVL tree keeps the balance factor (height of left subtree minus height of right) of every node at -1, 0 or +1, restoring it with rotations after each insertion or deletion, so its height stays O(log n).

It does not save memory (each node stores extra balance information), does not speed up memory access itself, and does not simplify storage, since rotations make insertion more complex.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.