From d625eacc18b348f16056fc971afef42ad1ebe460 Mon Sep 17 00:00:00 2001 From: Yudong Jin Date: Fri, 26 Jul 2024 16:39:34 +0800 Subject: [PATCH] Update avl_tree.md --- en/docs/chapter_tree/avl_tree.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/en/docs/chapter_tree/avl_tree.md b/en/docs/chapter_tree/avl_tree.md index a8be0a948..0c4d6b3e2 100644 --- a/en/docs/chapter_tree/avl_tree.md +++ b/en/docs/chapter_tree/avl_tree.md @@ -289,18 +289,18 @@ It can be observed that **the right and left rotation operations are logically s [file]{avl_tree}-[class]{avl_tree}-[func]{left_rotate} ``` -### Right-left rotation - -As shown in the figure below, for the mirror case of the above unbalanced binary tree, a "right rotation" needs to be performed on `child` first, followed by a "left rotation" on `node`. - -![Left-right rotation](avl_tree.assets/avltree_right_left_rotate.png) - ### Left-right rotation For the unbalanced node 3 shown in the figure below, using either left or right rotation alone cannot restore balance to the subtree. In this case, a "left rotation" needs to be performed on `child` first, followed by a "right rotation" on `node`. ![Right-left rotation](avl_tree.assets/avltree_left_right_rotate.png) +### Right-left rotation + +As shown in the figure below, for the mirror case of the above unbalanced binary tree, a "right rotation" needs to be performed on `child` first, followed by a "left rotation" on `node`. + +![Left-right rotation](avl_tree.assets/avltree_right_left_rotate.png) + ### Choice of rotation The four kinds of imbalances shown in the figure below correspond to the cases described above, respectively requiring right rotation, left-right rotation, right-left rotation, and left rotation.