![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Depth-first Search
文章平均质量分 81
candy_crush
胡编乱写
展开
-
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.判断两棵二叉树是否相原创 2016-09-17 16:34:06 · 172 阅读 · 0 评论 -
Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2 2 / \ / \3 4 4 3原创 2016-09-17 18:07:50 · 238 阅读 · 0 评论 -
Minimum Depth of Binary Tree
Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.求二叉树的最短深度解法一:深度优先遍历DFS/**原创 2016-09-17 22:34:43 · 177 阅读 · 0 评论 -
Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.求二叉树的最大深度,采用深度优先遍历原则/** * Def原创 2016-09-17 21:52:08 · 314 阅读 · 0 评论 -
Balanced Binary Tree
Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never diffe原创 2016-09-18 10:43:31 · 273 阅读 · 0 评论 -
Path Sum
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary tree and sum原创 2016-09-18 11:26:05 · 195 阅读 · 0 评论