摘要:
二叉树的最大深度: 递归的分别获取左右子树的深度,返回较大的深度,每次加1即可。 代码: 二叉树的最小深度: 设置一个深度计数变量 每次获取二叉树的一层结点,依次遍历该层的结点,第一次遇到叶子结点就返回,此时的深度是最小深度。 阅读全文
posted @ 2016-06-08 15:29
沧浪少年
阅读(1859)
评论(0)
推荐(0)
摘要:
题目: Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. For 阅读全文
posted @ 2016-06-08 15:22
沧浪少年
阅读(200)
评论(0)
推荐(0)
摘要:
题目: Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from Wikipedia:In a complete binary tree every level 阅读全文
posted @ 2016-06-08 11:24
沧浪少年
阅读(722)
评论(0)
推荐(0)

浙公网安备 33010602011771号