摘要: 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 / \ ... 阅读全文
posted @ 2014-06-10 17:46 穆穆兔兔 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 1最容易想到的递归调用 1 bool isSameTree(TreeNode *r1, TreeNode *r2) 2 { 3 if(r1 == NULL && r2 == NULL) return true; //终止条件 4 if(r1 == NULL || r2 == NULL... 阅读全文
posted @ 2014-06-10 16:58 穆穆兔兔 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 前中后遍历 递归版 1 /* Recursive solution */ 2 class Solution { 3 public: 4 vector preorderTraversal(TreeNode *root) { 5 6 vector resul... 阅读全文
posted @ 2014-06-10 11:22 穆穆兔兔 阅读(259) 评论(0) 推荐(0) 编辑