介绍给大家一个快速排序的方法:
void sort(int a[ ], int l, int r)
{
int i = l;
int j = r;
int mid = a[(i+j)/2];
do
{
while(a[i]
while(a[j] >mid ) j--;
if( i
{
swap( a[i], a[j] );
}...
分类:
编程语言 时间:
2014-06-20 13:15:03
阅读次数:
292
题目
Given preorder and inorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
方法
根据树的中序遍历和前序遍历,来构造树,使用递归的思想。
Tre...
分类:
其他好文 时间:
2014-06-20 12:14:49
阅读次数:
262
查询已经创建的数据库 show dbs
选择数据库
use DATABASE_NAME
查询该数据库里面的集合 show collections
删除集合操作:
db.COLLECTION_NAME.drop()
插入数据操作:
db.COLLECTION_NAME.insert(
do...
分类:
数据库 时间:
2014-06-20 10:57:41
阅读次数:
275
等等通过实例自己实践之后的清晰了很多,多动手多动手,TO Do TO DO !...
分类:
编程语言 时间:
2014-06-20 09:43:55
阅读次数:
306
1.DOM和SAX的区别:
1)dom把所有的xml文档信息都存于内存中
sax无需一次把xml文件加载到内存中,采用的是事件驱动的操作
2)dom应用场景:对于大文件来说几乎不可能使用
dom可以直接获取某个节点的操作Document.get,而sax不可以
2.DOM和SAX的优缺点:
DOM的优势主要表现在:易用性强,使用DO...
分类:
其他好文 时间:
2014-06-20 09:26:24
阅读次数:
300
在JavaScript模块到底是什么event = function() { // do more
return { bind: function() {}, unbind: function() {}, trigger: function() ...
分类:
编程语言 时间:
2014-06-20 08:50:47
阅读次数:
408
服务端代码://echoSvr.c#include #include #include
#include #include #include #include #include #include #define ERR_EXIT(m) \ do \
{ \ perror(...
分类:
其他好文 时间:
2014-06-11 22:15:11
阅读次数:
292
算法描述
K-means算法是一种被广泛使用的基于划分的聚类算法,目的是将n个对象会分成k个簇。算法的具体描述如下:随机选取k个对象作为簇中心;Do
计算所有对象到这k个簇中心的距离,将距离最近的归入相应的簇; 重新计算每个簇的中心; 计算准则...
分类:
其他好文 时间:
2014-06-11 10:37:42
阅读次数:
192
You are given the following information, but you may prefer to do some research for yourself.
1 Jan 1900 was a Monday.Thirty days has September,
April, June and November.
All the rest have thirty...
分类:
其他好文 时间:
2014-06-07 13:56:52
阅读次数:
166
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca...
分类:
其他好文 时间:
2014-06-07 12:21:30
阅读次数:
284