heap: fix node removal
This commit is contained in:
parent
0943d3cb33
commit
d4f904b0e7
@ -219,9 +219,9 @@ HEAP_EXPORT(void heap_remove(struct heap* heap,
|
||||
*/
|
||||
for (;;) {
|
||||
smallest = child;
|
||||
if (child->left != NULL && less_than(smallest, child))
|
||||
if (child->left != NULL && less_than(child->left, smallest))
|
||||
smallest = child->left;
|
||||
if (child->right != NULL && less_than(smallest, child))
|
||||
if (child->right != NULL && less_than(child->right, smallest))
|
||||
smallest = child->right;
|
||||
if (smallest == child)
|
||||
break;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user