Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在观看 IIT 关于数据结构 (Dr.naveen garg) 关于 AVL 树的讲座。
我的问题:为什么T2的高度不能是(h-1)?
假设是树在插入之后是平衡的,没有旋转。 如果发生了旋转——这是另一种情况,你用旋转来处理它,我从这个假设中弄清楚"Since X remains balanced..",我们在这里展示了树只在这种情况下保持平衡。
"Since X remains balanced.."
如果 ht(T2) 像你说的那样是 (h-1) ,那么树在插入后将是不平衡的。这不是问题中假设的一部分。
因为 x 的平衡因子现在将是 2。因此必须进行旋转。