按照前序遍历的顺序把树用right连起来。本来想了半天,一点思路都没有,总觉得Inplace的解法一般都非常巧妙。后来我突发灵感,决定用一个变量记录当前访问到哪个点,真是太机智了~~ 1 /** 2 * Definition for binary tree 3 * struct TreeNode.....
分类:
其他好文 时间:
2014-07-06 14:02:26
阅读次数:
168
要求:用户从外部导入TXT文件(input textfile),该文件有三列,分别是storeNum,MosrName,MosrNum,如下是一个input textfile的Case:5099,Scoresby,56595250,Scoresby,56595211,Scoresby,5659513...
分类:
其他好文 时间:
2014-07-06 13:12:43
阅读次数:
232
简单的插入排序,总是超时,暂且放在这记录一下。
class Solution:
# @param head, a ListNode
# @return a ListNode
def insertionSortList(self, head):
if head == None or head.next == None:
return head
psuhead...
分类:
编程语言 时间:
2014-07-06 11:52:20
阅读次数:
230
本系列所有文章可以在这里查看http://blog.csdn.net/cloud_castle/article/category/2123873
接上文Qt5官方demo解析集18——Chapter
4: Using Custom Property Types
上个例子向我们展示了如何为QML调用的C++类型添加自定义类型的属性,在这个例子中我们更进一步,将这个类型更换为一个Pie...
分类:
其他好文 时间:
2014-07-06 11:37:26
阅读次数:
291
Elevator
Time Limit: 1000ms Memory limit: 32768K 有疑问?点这里^_^
题目描述
The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers de...
分类:
其他好文 时间:
2014-07-06 10:52:11
阅读次数:
188
本系列所有文章可以在这里查看http://blog.csdn.net/cloud_castle/article/category/2123873
接上文Qt5官方demo解析集19——Chapter
5: Using List Property Types
在前文中我们定义的PieChart和PieSlice这两个自定义QML类型只用来供app.qml文件使用,如果希望我们所定义的...
分类:
其他好文 时间:
2014-07-06 09:55:31
阅读次数:
373
spring 注入list set map properties...
分类:
编程语言 时间:
2014-07-06 09:23:29
阅读次数:
184
链表的归并排序
超时的代码
class Solution:
def merge(self, head1, head2):
if head1 == None:
return head2
if head2 == None:
return head1
# head1 and head2 point to the same link list
if head1 == he...
分类:
编程语言 时间:
2014-07-06 09:09:51
阅读次数:
275
For the exercises in this chapter we need a list of English words. There are lots of word lists available on the Web, but the most suitable for our pu...
分类:
其他好文 时间:
2014-07-05 22:45:55
阅读次数:
545
在STL中的list其实就是一个双向链表,我用的还不多。 1 // ------------------------------------------------------------------------- 2 // 文件名 : list1.cpp 3...
分类:
其他好文 时间:
2014-07-05 21:07:42
阅读次数:
170