Binary search tree over AVL tree

前端 未结 4 1945
没有蜡笔的小新
没有蜡笔的小新 2020-12-31 20:35

As far as I know the time complexity between AVL trees and Binary Search Trees are the same in average case, with AVLs beating BSTs in worst case scenarios. This gives me a

4条回答
  •  礼貌的吻别
    2020-12-31 21:05

    Since there is the added overhead of checking and updating balance factors and rotating nodes, insertion and deletion in AVL trees can be pretty slow when compared to non-balanced BST's.

    Because of the tight balancing, search will never take linear-like time, so you'll probably want to use AVL trees in situations where searching is a more frequent operation than updating the tree.

提交回复
热议问题