题目:Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1...
分类:
编程语言 时间:
2014-08-02 09:50:13
阅读次数:
232
题目是这样的:给你一个单链表的表头,再给你其中某个结点的指针,要你删除这个结点,条件是你的程序必须在O(1)的时间内完成删除。
由于有的同学对链表还不是很熟悉,本文尽量描述的通俗易懂,老鸟请直接跳过前面一大段。
链表结构如下:
struct node
{
int val;
node* next;
};
题目不是很难,很快就能想到好办法:)
首先回顾一下普通的删除方法,...
分类:
其他好文 时间:
2014-08-02 05:14:14
阅读次数:
231
#include#include#includeusing namespace std;struct node{ int a; char s[105]; }p[105];int cmp(node c,node b){ return c.a #include #inclu...
分类:
其他好文 时间:
2014-08-02 01:42:32
阅读次数:
246
错误#include#include#includeusing namespace std;struct node { int a; char s[1000]; }p[1000];int cmp(node c,node b){ return c.ap[k].s[j]) p[k].a++; ...
分类:
其他好文 时间:
2014-08-02 01:37:12
阅读次数:
212
c++构造函数初始化成员变量列表: 1 #pragma once 2 class Node 3 { 4 public: 5 int data; // 权值 6 Node *parent; // 父节点 7 Node *left; // 左子节...
分类:
编程语言 时间:
2014-08-02 01:35:02
阅读次数:
263
大家都知道在node中ReadableStream有两种模式:flowing mode和non-flowing mode。对于flowing mode的ReadableStream, 我们是没法控制它何时去读数据读多少的,它会去尽快的去消耗data,并emit出来。1 // in lib/_stre...
给出n(1#include #include #include #include const int N = 20010;using namespace std;struct node{ int flag; node *next[26];};int n,m,ans = 0;struct node *...
分类:
其他好文 时间:
2014-08-01 22:51:52
阅读次数:
220
在文章《Ubuntu和CentOS中分布式配置Hadoop-2.2.0》介绍了hadoop 2.2.0最基本的配置。hadoop 2.2.0中提供了HA的功能,本文在前文的基础上介绍hadoop 2.2.0HA的配置。
说明:
下文中的两台namenode机器名分别是namenode1和namenode2.其中namenode1为active node,namenode2为standby na...
分类:
其他好文 时间:
2014-08-01 19:48:22
阅读次数:
243
在JavaFX中提供了一个很实用的功能。我们可以将任意节点截图导出。
代码如下:
WritableImage image = mapCanvas.snapshot(new SnapshotParameters(), null);
try {
ImageIO.write(SwingFXUtils.fromFXImage(image, null), "png", fi...
分类:
编程语言 时间:
2014-08-01 19:42:22
阅读次数:
1318
描述:注意需要先self.connect(right)再self.connect(left),否则会有case通不过,原因是左边递归执行时依赖与右边的next已经建立,而先执行connect(left)的话右边还没有完成关系的建立。代码: 1 class Solution: 2 # @par...
分类:
其他好文 时间:
2014-08-01 19:15:42
阅读次数:
223