二叉树后序遍历<非递归>
while(curr) { //print left most node, notice the root node if ((curr->left && curr->left->visited == false) || (curr->right && curr->right->visited == false)) { while (curr->left || curr->right) { if (curr->left && curr->left->visited == false) { curr = curr->left; treeStack.push_back(curr); continue; } curr = curr->right; treeStack.push_back(); } continue; } printTree(curr); curr->visited = true; curr = treeStack.pop_back(); }