AVL Tree


為一個binary search tree,且左右子樹高度不相差超過1。

  • Balance factor = HL - HR
    -->相差不超過一

  • Insertion
    1.RR imbalance
    2.LL imbalance

    -->直線的話,可作Single Rotation來解
    3.RL imbalance
    4.LR imbalance

    -->之字形的話,用Double Rotation來解

  • Removal

  • Performance
    O(logn)

results matching ""

    No results matching ""