码迷,mamicode.com
首页 >  
搜索关键字:sametree    ( 16个结果
100. Same Tree
Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally ident ...
分类:其他好文   时间:2017-12-12 11:13:47    阅读次数:159
Leetcode 100. Same Tree
思路1: 递归,如果 p = q, 那么判段 sameTree(p.left)==sameTree(q.left) and sameTree(p.right) = sameTree(q.right) 思路二: 如果两个树相同,说明按照一定的方式遍历这两个树,应该得到一样的结果。这里用的方法是使用st ...
分类:其他好文   时间:2017-01-25 07:44:44    阅读次数:200
100. Same Tree
Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical a ...
分类:其他好文   时间:2016-10-26 07:29:07    阅读次数:215
LeetCode100 SameTree java题解
题目: Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have the same value. 解题:...
分类:编程语言   时间:2015-07-06 21:49:34    阅读次数:132
[LeetCode]Same Tree
Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have the same value. /** ...
分类:其他好文   时间:2014-08-03 12:54:55    阅读次数:201
LeetCode SameTree
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(...
分类:其他好文   时间:2014-06-25 18:42:46    阅读次数:172
16条   上一页 1 2
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!