摘要:
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ ... 阅读全文
摘要:
1最容易想到的递归调用 1 bool isSameTree(TreeNode *r1, TreeNode *r2) 2 { 3 if(r1 == NULL && r2 == NULL) return true; //终止条件 4 if(r1 == NULL || r2 == NULL... 阅读全文
摘要:
前中后遍历 递归版 1 /* Recursive solution */ 2 class Solution { 3 public: 4 vector preorderTraversal(TreeNode *root) { 5 6 vector resul... 阅读全文