LeetCode题解之Binary Tree Postorder Traversal

1、题目描述

2、问题分析

递归

3、代码

 1 vector<int> postorderTraversal(TreeNode* root) {
 2         vector<int> v;
 3         postBorder(root,v);
 4         return v;
 5     }
 6     
 7     void postBorder(TreeNode *root, vector<int> &v)
 8     {
 9         if (root == NULL)
10             return ;
11         postBorder(root->left, v);
12         postBorder(root->right, v);
13         v.push_back(root->val);
14     }
原文地址:https://www.cnblogs.com/wangxiaoyong/p/10424488.html