add iterative solution for preorder traversal.