iterative preorder