aboutsummaryrefslogtreecommitdiff
path: root/collections/map/map.c
diff options
context:
space:
mode:
authorTucker Evans <tucker@tuckerevans.com>2020-07-08 23:15:09 -0400
committerTucker Evans <tucker@tuckerevans.com>2020-07-08 23:15:09 -0400
commit4aa74a480dea253256b2d4caf67fb56ea4de4b6c (patch)
tree0e647ccd15ce20c18291af896edd9c0d93000ef7 /collections/map/map.c
parent9ca52d7be8835cbca3e55df6fba26c6a0dea8b19 (diff)
Fix which rotates should be done for map rebalance
The rotations were just mirrors of what they should be, nothing really complicated.
Diffstat (limited to 'collections/map/map.c')
-rw-r--r--collections/map/map.c8
1 files changed, 4 insertions, 4 deletions
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);
}
}