美文网首页
Lintcode469 Identical Binary Tre

Lintcode469 Identical Binary Tre

作者: 程风破浪会有时 | 来源:发表于2018-03-21 08:25 被阅读0次

【题目描述】

Check if two binary trees are identical. Identical means the two binary trees have the same structure and every identical position has the same value.

检查两棵二叉树是否等价。等价的意思是说,首先两棵二叉树必须拥有相同的结构,并且每个对应位置上的节点上的数都相等。

【题目链接】

www.lintcode.com/en/problem/identical-binary-tree/

【题目解析】

对两棵树同时使用递归进行前序遍历,并对同一位置的节点进行判断,如有不相等则不是等价二叉树。

【参考答案】

www.jiuzhang.com/solutions/identical-binary-tree/

相关文章

网友评论

      本文标题:Lintcode469 Identical Binary Tre

      本文链接:https://www.haomeiwen.com/subject/bamkoxtx.html