easy recursive DFS vs iteration using 1 stack &  1 deque
Intuition\n Describe your first thoughts on how to solve this problem. \n2 kinds of solutions are provided.\n1. Recursive DFS: that is just a generalization of 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n2 kinds of solutions are provided.\n1. Recursive DFS: that is just a generalization of easy postorder transversal for binary tree which is done in seconds.\n2. Iteration: tricky or hard. That\'s done in a tricky way. Using a variant of PreOrder transversal(from rightmost child to leftmost child), the answering vector is using deque for avoiding of reverse.\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. 1st approach is very easy, it generalizes the postOrder recursive method for binary tree.\n2. 2nd approach is a iterative solution, tricky but not hard.\n3. Use a variant PreOrder transveral, the visiting order root->rightmost child->...->leftmost child. (The standard iterative version using 1 stack for preOrder is not hard)\n4. In the implemenation a stack is used (implemented by `vector<Node*>`), the order for feeding order is from leftmost child to rightmost child.\n5. For avoiding of reversing  the answering container, a `std::deque` is used, the number `curr->val` is pushed front, not pushed back.\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n$O(n)$\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n$O(|tree\\ height|)$\nIteration: $O(n)$\n# Code recursive DFS\n```cpp []\n/*\n// Definition for a Node.\nclass Node {\npublic:\n    int val;\n    vector<Node*> children;\n\n    Node() {}\n\n    Node(int _val) {\n        val = _val;\n    }\n\n    Node(int _val, vector<Node*> _children) {\n        val = _val;\n        children = _children;\n    }\n};\n*/\n\nclass Solution {\npublic:\n    vector<int> ans;\n    vector<int> postorder(Node* root) {\n        if (!root) return ans;\n        for(auto& child: root->children)\n            postorder(child);\n        ans.push_back(root->val);\n        return ans;\n    }\n};\n```\n# C++ iteration using deque\n```\n/*\n// Definition for a Node.\nclass Node {\npublic:\n    int val;\n    vector<Node*> children;\n\n    Node() {}\n\n    Node(int _val) {\n        val = _val;\n    }\n\n    Node(int _val, vector<Node*> _children) {\n        val = _val;\n        children = _children;\n    }\n};\n*/\n\nclass Solution {\npublic:\n    vector<int> postorder(Node* root) {\n        if (!root) return {};\n        vector<Node*> stack={root};\n        deque<int> q;\n        while(!stack.empty()){\n            auto curr=stack.back();\n            stack.pop_back();\n            q.push_front(curr->val);\n            for(auto& child: curr->children)\n                if (child) stack.push_back(child);\n        }\n        return vector<int>(q.begin(), q.end());\n    }\n};\n```
['Stack', 'Tree', 'Depth-First Search', 'Queue', 'C++']