preorder traversal of btree with explicit stack