Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,2...
分类:
其他好文 时间:
2014-12-03 21:12:08
阅读次数:
201
Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For exa...
分类:
其他好文 时间:
2014-12-03 21:09:03
阅读次数:
119
Swap是Linux下的交换分区,类似Windows的虚拟内存,当物理内存不足时,系统可把一些内存中不常用到的程序放入Swap,解决物理内存不足的情况。若系统安装时开辟的Swap空间太小,可通过手动创建Swap文件。一、创建文件dd if=/dev/zero of=kwxgd bs=1024 cou...
分类:
系统相关 时间:
2014-12-03 15:41:08
阅读次数:
264
Clone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors.OJ's undirected graph serialization:Nodes are labeled uniq...
分类:
其他好文 时间:
2014-12-03 13:57:44
阅读次数:
157
Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For exam...
分类:
其他好文 时间:
2014-12-03 13:49:04
阅读次数:
154
Clone an undirected graph. Each node in the graph contains a label and
a list of its neighbors.
OJ's undirected graph serialization:
Nodes are labeled uniquely.
We use # as a separator for each...
分类:
其他好文 时间:
2014-12-03 12:34:14
阅读次数:
113
问题描述:
Given a linked list and a value x, partition it such that all nodes less than
x come before nodes greater than or equal to x.
You should preserve the original relative order of the nodes in...
分类:
其他好文 时间:
2014-12-03 00:27:55
阅读次数:
141
Binary Tree Inorder TraversalGiven a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ...
分类:
其他好文 时间:
2014-12-02 22:10:23
阅读次数:
138
思路简单:
(1) 三重 for ,符合a+b+c=0的 a,b,c保存在tuple里
(2)tuple保存在set 中,一可去重,二可保持字典序
(3)简单代价就是复杂度很高,O(n^3*logn)
typedef tuple triplet;
triplet sort3(int a,int b,int c){
if(ac){
swap(b,c);...
分类:
其他好文 时间:
2014-12-02 15:18:10
阅读次数:
285
最近由于工作上的事情都处理的差不多,手头没啥任务;在就是一直对各种排序算法只有些模糊的概念,上学那会就没有
好好的学习和实际在机上操作过,所以在此特意整理了下这几个比较经典的排序算法,同时也在机上尝试过几次都没问题
了,希望对以后会有所帮助,若有不足之处,待改进!
别的也不想多说,直接上代码吧
/*function:交换两个数函数*/
void swap(int *num1, int *n...
分类:
编程语言 时间:
2014-12-02 15:13:26
阅读次数:
225