摘要: 解法一:递归 1 bool isSameTree(TreeNode* p, TreeNode* q) 2 { 3 if (p == NULL && q == NULL) 4 return true; 5 if ((p == NULL && q != NULL) || ... 阅读全文
posted @ 2015-07-05 19:27 QingLiXueShi 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 解法一:递归1 int maxDepth(TreeNode* root)2 {3 if (root == NULL)4 return 0;5 6 int max_left_Depth = maxDepth(root->left);7 int max_right... 阅读全文
posted @ 2015-07-05 17:18 QingLiXueShi 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 解法一:From top to bottom 1 int treeHeight(TreeNode *T) 2 { 3 if (T == NULL) 4 return 0; 5 6 return max(treeHeight(T->left), treeHei... 阅读全文
posted @ 2015-07-05 17:03 QingLiXueShi 阅读(140) 评论(0) 推荐(0) 编辑