Problem Description:
Given a binary tree, determine if it is a valid binary search tree (BST).
Assume a BST is defined as follows:
The left subtree of a node contains only nodes with keys l...
分类:
其他好文 时间:
2014-05-15 11:22:21
阅读次数:
317
断言:学java的时候学过断言,但一直用的很少,node中也有varassert=require(‘assert‘)
console.info(‘.......startapp.......‘);
varactual=1;
varexpect=‘1‘
vara;
//判断是否为真
assert(a,‘isnotvalid‘);
assert.ok(0,‘isnoteffective‘);
//arg[0]为真实值,arg[1]期望值,a..
分类:
Web程序 时间:
2014-05-15 09:09:47
阅读次数:
373
使用模块第一种应用://module/AppUtils.js
exports.random=function(){
returnMath.random();
}
exports.showAuthor=function(){
return"chenlong";
}
//app.js
varut=require(‘./module/AppUtils‘);
console.info(‘.......startapp.......‘);
varrn=ut.random();
varmy=ut.sh..
分类:
Web程序 时间:
2014-05-15 08:44:50
阅读次数:
398
tarjan算法第一题
喷我一脸。。。。把手写栈的类型开成了BOOL,一直在找错。。。
#include
#include
#include
#include
#define maxn 100005
const int MOD=1000000007;
using namespace std;
struct node
{
int to,next;
}edge[maxn...
分类:
其他好文 时间:
2014-05-15 08:18:56
阅读次数:
353
昨天对网站的架构做了一个简要的分析,有些人不太理解,有了 NodeJS 还要 php
干啥?我推荐了几篇文章给这位童鞋看了:也谈基于NodeJS的全栈式开发(基于NodeJS的前后端分离)基于前后端分离的模版探索Midway-ModelProxy
— 轻量级的接口配置建模框架前后端分离模式下的安全解...
分类:
Web程序 时间:
2014-05-15 07:29:47
阅读次数:
398
1、
??
Populating Next Right Pointers in Each Node
Given a binary tree
struct TreeLinkNode {
TreeLinkNode *left;
TreeLinkNode *right;
TreeLinkNode *next;
}
Populate...
分类:
其他好文 时间:
2014-05-15 04:57:36
阅读次数:
221
题意:移除链表的倒数第n个元素
思路:
两个指针p, q,
p先走n步,然后p,q一起走,当p走到尾的时候,q->next就是要删除的节点
复杂度: 时间O(n),空间O(1)...
分类:
其他好文 时间:
2014-05-15 02:53:13
阅读次数:
241
Pat1043代码题目描述:A Binary Search Tree (BST) is
recursively defined as a binary tree which has the following properties:The left
subtree of a node contain...
分类:
其他好文 时间:
2014-05-14 22:03:25
阅读次数:
487
这篇文章提出了backgroundjs这个新的概念,扩展了Node.js的能力,解决了Node在处理CPU密集任务时的短板。这个解决方案使得使用Node的开发人员只需要关注backgroundjs中的函数。比起多开进程或者新添加模块的解决方案更高效,通用和一致。...
分类:
Web程序 时间:
2014-05-14 21:16:18
阅读次数:
502
node.js API 英文原版
http://nodejs.org/api/all.html
node.js API 中文翻译
http://nodeapi.ucdok.com/#/api/
node.js API 中文翻译下载
http://download.csdn.net/detail/bad19876414641/4608699
javascrip...
分类:
Web程序 时间:
2014-05-14 15:15:10
阅读次数:
329