From 4aa74a480dea253256b2d4caf67fb56ea4de4b6c Mon Sep 17 00:00:00 2001 From: Tucker Evans Date: Wed, 8 Jul 2020 23:15:09 -0400 Subject: Fix which rotates should be done for map rebalance The rotations were just mirrors of what they should be, nothing really complicated. --- collections/map/map.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'collections/map/map.c') diff --git a/collections/map/map.c b/collections/map/map.c index c217fa2..321339f 100644 --- a/collections/map/map.c +++ b/collections/map/map.c @@ -88,17 +88,17 @@ struct map_node **root; if (map_height((*root)->left) > map_height((*root)->right)) { if(map_bal_factor((*root)->left) >= 0) { - map_rotate_left(root); + map_rotate_right(root); } else { - map_rotate_left(root); map_rotate_right(root); + map_rotate_left(root); } } else { if (map_bal_factor((*root)->right) >= 0) { - map_rotate_right(root); + map_rotate_left(root); } else { - map_rotate_right(root); map_rotate_left(root); + map_rotate_right(root); } } -- cgit v1.1