I.graph II.binary search 重在 begin=mid; end=mid; begin=mid+1; end=mid-1; if(begin<end) if(begin<=end)的选择上。
分类:
编程语言 时间:
2016-03-13 22:28:07
阅读次数:
299
题目:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1
/ 2 2
/ \ / 3 4 4 3
But the following is...
分类:
其他好文 时间:
2016-03-13 18:06:55
阅读次数:
153
In computer science, a binary tree is a tree data structure in which each node has at most two children. Consider an infinite full binary tree (each n
分类:
其他好文 时间:
2016-03-13 14:34:03
阅读次数:
184
一、二叉排序树定义 1.二叉排序树的定义 二叉排序树(Binary Sort Tree)又称二叉查找(搜索)树(Binary Search Tree)。其定义为:二叉排序树或者是空树,或者是满足如下性质的二叉树:①若它的左子树非空,则左子树上所有结点的值均小于根结点的值;②若它的右子树非空,则右子树
分类:
编程语言 时间:
2016-03-13 14:31:37
阅读次数:
309
Given a binary tree, find its maximum depth.
分类:
其他好文 时间:
2016-03-13 14:29:24
阅读次数:
167
题目: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikip
分类:
其他好文 时间:
2016-03-13 14:10:33
阅读次数:
149
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia
分类:
其他好文 时间:
2016-03-13 08:57:50
阅读次数:
136
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowes
分类:
其他好文 时间:
2016-03-13 08:52:28
阅读次数:
134
这题还是简单的二叉树递归遍历相关的基础。 首先题目要求判断给出的是否平衡二叉树,而平衡二叉树又是左、右子树的高度差值小于1。所以我们判断前,先要知道左、右子树的高度值,所以我们要另外添加一个函数去遍历。 前面的思路还是很简单,但是被一个地方坑到。这就是在求出左、右子树高度值的函数里面,两
分类:
其他好文 时间:
2016-03-13 06:13:23
阅读次数:
104