Fix nextTreeData
This commit is contained in:
parent
c79a61e8ee
commit
492a101160
@ -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);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user