mirror of
https://github.com/krahets/hello-algo.git
synced 2026-09-22 22:36:35 +08:00
deploy
This commit is contained in:
@@ -1752,18 +1752,18 @@
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#3-right-left-rotation" class="md-nav__link">
|
||||
<a href="#3-left-right-rotation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
3. Right-left rotation
|
||||
3. Left-right rotation
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#4-left-right-rotation" class="md-nav__link">
|
||||
<a href="#4-right-left-rotation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
4. Left-right rotation
|
||||
4. Right-left rotation
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -3724,18 +3724,18 @@
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#3-right-left-rotation" class="md-nav__link">
|
||||
<a href="#3-left-right-rotation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
3. Right-left rotation
|
||||
3. Left-right rotation
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#4-left-right-rotation" class="md-nav__link">
|
||||
<a href="#4-right-left-rotation" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
4. Left-right rotation
|
||||
4. Right-left rotation
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -4463,15 +4463,15 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h3 id="3-right-left-rotation">3. Right-left rotation<a class="headerlink" href="#3-right-left-rotation" title="Permanent link">¶</a></h3>
|
||||
<h3 id="3-left-right-rotation">3. Left-right rotation<a class="headerlink" href="#3-left-right-rotation" title="Permanent link">¶</a></h3>
|
||||
<p>For the unbalanced node 3 shown in Figure 7-30, using either left or right rotation alone cannot restore balance to the subtree. In this case, a "left rotation" needs to be performed on <code>child</code> first, followed by a "right rotation" on <code>node</code>.</p>
|
||||
<p><a class="glightbox" href="../avl_tree.assets/avltree_left_right_rotate.png" data-type="image" data-width="100%" data-height="auto" data-desc-position="bottom"><img alt="Right-left rotation" class="animation-figure" src="../avl_tree.assets/avltree_left_right_rotate.png" /></a></p>
|
||||
<p align="center"> Figure 7-30 Right-left rotation </p>
|
||||
<p><a class="glightbox" href="../avl_tree.assets/avltree_left_right_rotate.png" data-type="image" data-width="100%" data-height="auto" data-desc-position="bottom"><img alt="Left-right rotation" class="animation-figure" src="../avl_tree.assets/avltree_left_right_rotate.png" /></a></p>
|
||||
<p align="center"> Figure 7-30 Left-right rotation </p>
|
||||
|
||||
<h3 id="4-left-right-rotation">4. Left-right rotation<a class="headerlink" href="#4-left-right-rotation" title="Permanent link">¶</a></h3>
|
||||
<h3 id="4-right-left-rotation">4. Right-left rotation<a class="headerlink" href="#4-right-left-rotation" title="Permanent link">¶</a></h3>
|
||||
<p>As shown in Figure 7-31, for the mirror case of the above unbalanced binary tree, a "right rotation" needs to be performed on <code>child</code> first, followed by a "left rotation" on <code>node</code>.</p>
|
||||
<p><a class="glightbox" href="../avl_tree.assets/avltree_right_left_rotate.png" data-type="image" data-width="100%" data-height="auto" data-desc-position="bottom"><img alt="Left-right rotation" class="animation-figure" src="../avl_tree.assets/avltree_right_left_rotate.png" /></a></p>
|
||||
<p align="center"> Figure 7-31 Left-right rotation </p>
|
||||
<p><a class="glightbox" href="../avl_tree.assets/avltree_right_left_rotate.png" data-type="image" data-width="100%" data-height="auto" data-desc-position="bottom"><img alt="Right-left rotation" class="animation-figure" src="../avl_tree.assets/avltree_right_left_rotate.png" /></a></p>
|
||||
<p align="center"> Figure 7-31 Right-left rotation </p>
|
||||
|
||||
<h3 id="5-choice-of-rotation">5. Choice of rotation<a class="headerlink" href="#5-choice-of-rotation" title="Permanent link">¶</a></h3>
|
||||
<p>The four kinds of imbalances shown in Figure 7-32 correspond to the cases described above, respectively requiring right rotation, left-right rotation, right-left rotation, and left rotation.</p>
|
||||
|
||||
Reference in New Issue
Block a user