**Why can I access private variables in the
copy constructor?** >The access modifiers work on **class level**, and not on
object level.That is, two ob...
分类:
编程语言 时间:
2014-05-12 15:06:06
阅读次数:
315
原题地址:http://oj.leetcode.com/problems/balanced-binary-tree/题意:判断一颗二叉树是否是平衡二叉树。解题思路:在这道题里,平衡二叉树的定义是二叉树的任意节点的两颗子树之间的高度差小于等于1。这实际上是AVL树的定义。首先要写一个计算二叉树高度的函...
分类:
编程语言 时间:
2014-05-12 14:51:47
阅读次数:
304
原题地址:http://oj.leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/题意:根据二叉树的先序遍历和中序遍历恢复二叉树。解题思路:可以参照http://www.cnblogs.com...
分类:
编程语言 时间:
2014-05-12 14:24:57
阅读次数:
324
原题地址:http://oj.leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/题意:根据二叉树的中序遍历和后序遍历恢复二叉树。解题思路:看到树首先想到要用递归来解题。以这道题为例:如果一...
分类:
编程语言 时间:
2014-05-12 14:09:28
阅读次数:
321
原题地址:http://oj.leetcode.com/problems/binary-tree-inorder-traversal/题意:二叉树的中序遍历。解题思路:这道题用递归解不难,所以应该考察的是非递归求解二叉树的中序遍历。我们使用一个栈来解决问题。比如一颗二叉树为{1,2,3,4,5,6,...
分类:
编程语言 时间:
2014-05-12 12:48:36
阅读次数:
316
原题地址:http://oj.leetcode.com/problems/binary-tree-preorder-traversal/题意:这题用递归比较简单。应该考察的是使用非递归实现二叉树的先序遍历。解题思路:使用一个栈。先遍历节点,然后将这个节点入栈,如果这个节点的左孩子非空,遍历左孩子,然...
分类:
编程语言 时间:
2014-05-12 12:09:39
阅读次数:
327
下面是它们的英文定义:A northbound interface is an
interface that conceptualizes lower level details. It interfaces to higher level
layers and is normally drawn ...
分类:
其他好文 时间:
2014-05-12 10:43:29
阅读次数:
296
题目描述There is a grid size of 1*N. The spanning tree
of the grid connects all the vertices of the grid only with the edges of the
grid, and every vertex...
分类:
其他好文 时间:
2014-05-10 19:00:03
阅读次数:
337
Problem DescriptionIn 2100, since the sea level
rise, most of the cities disappear. Though some survived cities are still
connected with others, but m...
分类:
其他好文 时间:
2014-05-10 07:33:38
阅读次数:
265
Pat1076代码
题目描述:
Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with foll...
分类:
其他好文 时间:
2014-05-10 04:50:24
阅读次数:
403