Traverse the following binary tree in preorder. Show the contents of the traversal's stack as the algorithm progresses.
There is a binary tree on top of the screen. Drag items from the tree onto the stack and from the stack to linked list on the bottom of the screen. Start your simulation by dragging the root-node of the tree to the stack.
You can simulate stack's push by dragging and dropping the key on the stack. Pop can be performed by dragging and dropping the key from the stack onto the linked list.
Some addditional problems.
Algorithm PreOrderTreeTraversal(root) 1 S.push(root) 2 while (S.notEmpty()) do 3 next = S.pop() 4 visit(next) 5 if (next->right != NULL) S.push(next->right) 6 if (next->left != NULL) S.push(next->left)