JavaScript模块化规范主要遵循CommonJS和AMD规范。CommonJS规范-服务器端JavaScript规范Node.js是一个服务器端JavaScript项目,采用了CommonJS标准实现其模块系统。CommonJS中采用一个全局require方法来加载模块,主要由原生模块modu...
分类:
编程语言 时间:
2014-05-19 17:56:40
阅读次数:
293
为了解释本节的目的,首先想象一下,我们有包含了三个node的cluster,这个cluster有一个名称是blogs的index,这个index有两个primary
shard。每个primary shard有两个replica。相对应的shard的数据备份不会在相同的node,因此,这个clust...
分类:
其他好文 时间:
2014-05-19 16:44:31
阅读次数:
287
A linked list is given such that each node
contains an additional random pointer which could point to any node in the list
or null.Return a deep copy ...
分类:
其他好文 时间:
2014-05-19 15:50:28
阅读次数:
447
一个文档可以从primary shard和任意一个相对应的replica
shard中检索:就像上面图形中表示的,下面列出从primary shard或这replica
shard检索document的步骤:1:客户端发送请求到node12:这个node使用document的_id判定documen...
分类:
其他好文 时间:
2014-05-19 15:30:30
阅读次数:
251
Node.js安装与配置
Node.js已经诞生两年有余,由于一直处于快速开发中,过去的一些安装配置介绍多数针对0.4.x版本而言的,并非适合最新的0.6.x的版本情况了,对此,我们将在0.6.x的版本上介绍Node.js的安装和配置。(本文一律以0.6.1为例,0.6的其余版本,只需替换版本号即....
分类:
Web程序 时间:
2014-05-19 13:04:08
阅读次数:
380
【题目】
Given a linked list, remove the nth node from the end of list and return its head.
For example,
Given linked list: 1->2->3->4->5, and n = 2.
After removing the second node from the end, the linked list becomes 1->2->3->5.
Note:
Given n will ...
分类:
其他好文 时间:
2014-05-18 18:48:03
阅读次数:
269
分析:暴力要超时,所以把每个数字转换为长度为32的0-1字符串,用字典树。因为其公共前缀的特性,空间上可以承受。因为是二叉树,用node[SIZE][2]存放。不知道new速度是否会慢很多,所以没用指针。...
分类:
其他好文 时间:
2014-05-18 18:37:37
阅读次数:
218
python创建二叉树,源代码如下:
#!/usr/bin/python
class node():
def __init__(self,k=None,l=None,r=None):
self.key=k;
self.left=l;
self.right=r;
def create(root):
a=raw_input('enter a key:');
if a is '#...
分类:
编程语言 时间:
2014-05-18 09:27:13
阅读次数:
384
链表是数据结构的基础内容之一,下面就链表操作中的创建链表、打印链表、求取链表长度、判断链表是否为空、查找结点、插入结点、删除结点、逆转链表、连接链表、链表结点排序等进行总结。
1.创建表示结点的类,因为链表操作中需要比较结点,因此结点需要实现comparable接口。
public class Node implements Comparable {
private Object data;...
分类:
其他好文 时间:
2014-05-18 03:04:38
阅读次数:
316
好多人都是为了找实习、找工作,看看思路,手写下这个问题的代码。如果有机会还是最好真正调试一下,还是有很多细节需要注意的。不多说了,代码记录如下:
Node* Merge(Node *h1,Node *h2)
{
Node *head,*pCurrent,*head1,*head2;
head1 = h1;
head2 = h2;
if(head1==NULL)
retu...
分类:
其他好文 时间:
2014-05-18 02:59:29
阅读次数:
214