Fix nextTreeData

This commit is contained in:
D2A62006 2025-12-07 21:26:44 +01:00
parent c79a61e8ee
commit 492a101160

View File

@ -77,12 +77,14 @@ void *nextTreeData(TreeNode *root)
current = root; current = root;
} }
while (current != NULL) while (current != NULL){
{
stack = push(stack, current); stack = push(stack, current);
current = current->left; current = current->left;
} }
if(stack == NULL){
return 0;
}
TreeNode *node = (TreeNode *)top(stack); TreeNode *node = (TreeNode *)top(stack);
stack = pop(stack); stack = pop(stack);