diff options
-rw-r--r-- | collections/map/map.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/collections/map/map.c b/collections/map/map.c index 015a3cb..5ad0b65 100644 --- a/collections/map/map.c +++ b/collections/map/map.c @@ -117,18 +117,18 @@ struct map_node **root; return; if (map_height((*root)->left) > map_height((*root)->right)) { - if(map_bal_factor((*root)->left) >= 0) { + if(map_bal_factor((*root)->left) <= 0) { map_rotate_right(root); } else { - map_rotate_right(&(*root)->left); - map_rotate_left(root); + map_rotate_left(&(*root)->left); + map_rotate_right(root); } } else { if (map_bal_factor((*root)->right) >= 0) { map_rotate_left(root); } else { - map_rotate_left(&(*root)->right); - map_rotate_right(root); + map_rotate_right(&(*root)->right); + map_rotate_left(root); } } |