Skip to content

Commit ab238a0

Browse files
author
fuli
committed
fixed a bug in leaf node delete
1 parent bbdbbf3 commit ab238a0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

include/dos_tree.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ namespace alg
131131
delete_case1(n);
132132
}
133133
replace_node(n, child);
134+
// copy child value if exists
135+
if (child != NULL) {
136+
DOSNODE(n)->key = DOSNODE(child)->key;
137+
DOSNODE(n)->size = DOSNODE(child)->size;
138+
}
134139
if (n->parent == NULL && child != NULL)
135140
child->color = BLACK;
136141

0 commit comments

Comments
 (0)