From 1cd08117d9506d72bf4bf87a12ad4720d0892407 Mon Sep 17 00:00:00 2001 From: Tucker Evans Date: Fri, 24 Jul 2020 15:25:59 -0400 Subject: Fix map AVL rotations --- collections/map/map.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'collections/map') 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); } } -- cgit v1.1