iterative preorder traversal