Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).
For example:
Given binary tree {3,9,20,#,#,15,7},
3
/ 9 20
...
分类:
其他好文 时间:
2014-09-29 19:55:01
阅读次数:
169
Given a linked list, swap every two adjacent nodes and return its head.
For example,
Given 1->2->3->4, you should return the list as 2->1->4->3.
Your algorithm should use only constant space. Y...
分类:
其他好文 时间:
2014-09-29 01:40:57
阅读次数:
297
#include#include #include"windows.h"using namespace std;struct StaticLinkNode{ int data; int next;};struct StaticLink{ StaticLinkNode* nodes;...
分类:
其他好文 时间:
2014-09-28 16:13:23
阅读次数:
135
Given a linked list, swap every two adjacent nodes and return its head.
For example,
Given 1->2->3->4, you should return the list as 2->1->4->3.
Your algorithm should use only constant space. Y...
分类:
其他好文 时间:
2014-09-28 14:33:56
阅读次数:
178
题意:
给定n个点的树,m个操作
树有点权和边权
下面n-1行给出树边
下面m行操作 :
● ADD1 u v k: for nodes on the path from u to v, the value of these nodes increase by k.
● ADD2 u v k: for edges on the path from u to v, the value...
分类:
其他好文 时间:
2014-09-27 20:30:00
阅读次数:
202
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 ea...
分类:
其他好文 时间:
2014-09-27 15:16:19
阅读次数:
121
struct ListNode { int m_nKey; ListNode *m_pNext;};void printListReversingly(ListNode *pHead) { stack nodes; ListNode *pNode = pHead; while (pNode != N...
分类:
其他好文 时间:
2014-09-26 11:42:08
阅读次数:
162
阶段三:我们这次试一下非正常退出模拟宕机方法:方法一:虚拟机挂起方法二:echoc>/proc/sysrq-trigger恢复所有节点(略)[root@web1~]#cman_toolstatus……Nodes:4Expectedvotes:8Totalvotes:8Nodevotes:2Quorum:5……=====Step1:对web3节点进行模拟故障=====[root@web1~..
分类:
其他好文 时间:
2014-09-26 00:15:48
阅读次数:
326
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 1 /** 2 ...
分类:
其他好文 时间:
2014-09-25 13:02:08
阅读次数:
204
Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3].思路:...
分类:
其他好文 时间:
2014-09-25 03:56:48
阅读次数:
215