- 博客(69)
- 资源 (16)
- 收藏
- 关注
原创 find_appear_once
pair find_appear_once(const int data[],int size) { int xor_two = 0; int i; for (i=0;i xor_two ^= data[i]; } ///* int flag = 0x01; while ((flag & xor_two) == 0) flag
2012-07-16 19:51:06
676
原创 _strtok
char* _strtok(char *s, const char *dm){ static char *last; char *tok; const char* pdm=dm; if(s == NULL) s = last; if(s == NULL) return NULL; tok = s; while
2012-05-29 15:54:01
565
原创 IsBalanced
bool IsBalanced(BinaryTreeNode* pRoot, int* pDepth){ if(pRoot == NULL) { *pDepth = 0; return true; } int left, right; if(IsBalanced(pRoot->m_pLeft, &left)
2012-05-21 10:57:40
775
原创 adsort
//ShellSort 希尔排序void ShellSort(int Data[],int n){ int i,j,gap; int temp; gap=n/2; while(gap>0) { for(i=gap;i<n;i++) { temp=Data[i]; j=i-gap; while(j>=0 && temp<D
2012-05-13 10:54:46
619
原创 void CBTInsert(BTNode *tree, BTNode *new_node)
void CBTInsert(BTNode *tree, BTNode *new_node){ int llcnt(0),lrcnt(0),rrcnt(0); BTNode *lch,*rch,*p,*lb; if(tree->lchild==NULL)//insert tree->lchild=new_node; else if(tree->rc
2012-05-01 22:24:51
1292
原创 ConvertBST2DoubleList
void Convert(Node * r,Node * & first,Node * & last){ Node *firstL,*lastL,*firstR,*lastR; if(r==NULL) return; Convert(r->left,firstL,lastL); Convert(r->right,firstR,lastR);
2012-02-22 13:44:17
477
原创 bit_map
unsigned char flags[1000];int getv(int idx){ int i=idx>>3; int j=idx&0x7; //return ((flags[i]&(0x1>j); return ((flags[i]>>j)&0x01);}int setv(int idx){ int i=idx>>3; int
2012-02-22 13:20:04
613
原创 findMaxDistance
int BTNodeDepth(BTNode *b){ int lchilddep,rchilddep; if(b==NULL) return 0; else { lchilddep=BTNodeDepth(b->lchild); rchilddep=BTNodeDepth(b->rchild); r
2012-02-17 20:16:27
747
原创 abc
C++语言: static int dictExpand(dict*ht,unsigned long size) { dict n; /* the new hashtable */ unsigned long realsize= _dictNextPower(size),i; /* the size is invalid if it
2012-02-16 11:22:33
578
原创 CreateBTfromPre
BTNode *CreateBTfromPre(char *pre,char *in,int n,int m){ BTNode *s; char *p,*q,*minp; int minpre,minin ,k; if(n<=0) return NULL; minpre=m+1; for(p=in;p<in+n;p++) for(q
2012-02-15 16:52:59
726
原创 insertNew
void insertNew(BTNode *tree, BTNode *new_node){ int llcnt(0),lrcnt(0),rrcnt(0); BTNode *lch,*rch,*p,*lb; if(tree->lchild==NULL)//insert tree->lchild=new_node; else if(tree->rc
2012-02-15 15:46:44
645
原创 CreatBT
BTNode *CreatBT(char *post,char *in,int n,int m){ BTNode *s; char *p,*q,*maxp; int maxpost,maxin ,k; if(n<=0) return NULL; maxpost=-1; for(p=in;p<in+n;p++) for(q=post;q<post+m;q++) if(*p==
2012-02-15 14:31:38
639
原创 find_mid
int find_mid( int *a, int *b, int length){ if (length == 1)//这里应该根据中位数的定义取大小 return a[0]<b[0]?a[0]:b[0]; int i = length/2; if (a[i] == b[i]) return a[i]; else if (a[i
2012-02-15 14:04:34
581
原创 find_seq
int cnt(0);int howmany(0);void find_seq(int A1, int n, int sum){ howmany++; int tmp=(A1+(n-1)/2.0)*n; if(tmp > sum) return; else if(tmp==sum) { cout<<"the seque
2012-02-15 14:01:07
615
原创 Android手机平台的软件管家
看到了 第二届 Google 暑期大学生博客分享大赛 - 2011 Android 成长篇 觉得还是很有意义的,借助这种大赛的形式,在广大用户之间做推广,应该会起到不错的效果。在信息高度发达、Android如日中天的今天,恐怕还少有在校学生没听说过Android吧。现在回想一下首
2011-07-27 11:17:35
1581
原创 Django+Python+GoogleAppEngine+HTML/XHTML+CSS = WEB APP
<br />(自己根据网上的各种资料总结了一个简洁有效的版本,希望能对这方面的新手有帮助)<br />In this tutorial I will show you how to get a simple datastore-backed Django application up and running on the Google App Engine. I will assume that you are somewhat familiar with Django and Python.<br /><
2010-07-11 16:51:00
1273
原创 WSGI
<br /> 什么是WSGI? WSGI is the Web Server Gateway Interface. It is a specification for web servers and application servers to communicate with web applications (though it can also be used for more than that). WSGI是Python应用程序或框架和Web服务器之间的一种接口,已经被广泛接受
2010-07-01 22:14:00
583
原创 ORM
<br />什么是ORM? 对象关系映射(ORM)提供了概念性的、易于理解的模型化数据的方法。ORM方法论基于三个核心原则: 简单:以最基本的形式建模数据。 传达性:数据库结构被任何人都能理解的语言文档化。 精确性:基于数据模型创建正确标准化了的结构。 典型地,建模者通过收集来自那些熟悉应用程序但不熟练的数据建模者的人的信息开发信息模型。建模者必须能够用非技术企业专家可以理解的术语在概念层次上与数据结构进行通讯。建模者也必须能以简单的单元分析信息,对样本数据进行处理。ORM专门
2010-07-01 22:11:00
506
原创 Using Django with Appengine
Using Django with AppengineAuthor: Shabda RaajVersion: 1Copyright: This document is released under a Creative Common Attribution license.Contents * About * What will we build * Downloading Django, and Appengine * Getting Help
2010-07-01 21:28:00
825
原创 emacs配置文件之备份(2)
(custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '
2010-06-29 09:27:00
536
原创 emacs配置文件之备份(1)
<br />(custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work righ
2010-06-12 18:31:00
589
原创 emacs配置文件之备份
(custom-set-variables(column-number-mode t);显示列号;(display-time-mode t)(size-indication-mode t)(transient-mark-mode nil)(global-linum-mode t)(cua-mode nil)(show-paren-mode t nil (p
2010-05-29 23:14:00
1571
原创 More Effective C++ 读书笔记 之 不以多态方式处理数组
最关键的问题是派生类和基类的大小可能不一致。这样两种类型的数组的元素间距(也就是元素大小)就不同。另外,C++标准中规定:通过基类指针删除一个由派生对象构成的数组,其结果未定义。 结论:由于多态和指针算术不能混合运用,而数组对象几乎总是涉及指针的算术运算,所以数组和多态不应混合使用。
2010-05-17 08:27:00
593
原创 More Effective C++ 读书笔记 之 C++转型操作符
取代旧式C的:static_cast改变常量性的:const_cast用于继承体系的:dynamic_cast还有一个:reinterpret_cast,与编译平台有关,常用于转换函数指针类型。
2010-05-17 08:19:00
503
原创 今天明白了一点模板函数的事情
下面这个代码出错: //test.htemplatevoid fun(T x); //test.cpp#include "test.h"templatevoid fun(T x){ std::cout<<x<<std::endl;} //main.cpp#include#include "test.h"int ma
2010-05-17 07:16:00
595
转载 学习GDB[转]
学习使用 GNU GDB Debugger 作者:王聪GDB 常用命令参考手册GDB 命令行参数GDB 命令GDB 操作提示GDB 相关手册相关链接 1 GDB 命令行参数启动 GDB:gdb ex
2010-05-13 11:01:00
849
转载 学习GCC[转]
学习 GNU Compiler Collection 作者:王聪来源:www.zeuux.orgGCC 的使用GCC 常用选项其它 GCC 选项相关书籍相关链接1 GCC的使用GCC 编译过程示意图:用法: g
2010-05-13 10:25:00
583
原创 More Effective C++ 读书笔记 之 区别pointer和reference
reference不能是空,必须有初值。通常在reference和point都适用时,reference有更好的效率(因为reference不需要测试是否为NULL)。当需要指向某个东西而且决不会改指其它东西,或是当实现一个操作符而其语法需求无法由pointer达成时(如operator[]),就应该选择references;任何其他时候,采用pointer.
2010-05-11 22:04:00
687
原创 emacs配置文件
(custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If th
2010-04-07 09:56:00
999
转载 中国剩余定及由此解决的一个问题
我国古代数学名著《孙子算经》中,记载这样一个问题: “今有物不知其数,三三数之剩二,五五数之剩三,七七数之剩二,问物几何。”用现在的话来说就是:“有一批物品,3个3个地数余2个,5个5个地数余3个,7个7个地数余2个,问这批物品最少有多少个?” 这个问题的解题思路,被称为“孙子问题”、“鬼谷算”、“隔墙算”、“韩信点兵”等等.那么,这个问题怎呢?明朝数学家程大位把这一解法编成四句歌诀: 三人
2010-03-07 10:58:00
1071
原创 C++中数据的精度和格式控制
//精度和格式控制#include#includeusing namespace std;int main(){ float n; cin>>setiosflags(ios::fixed)>>setprecision(2)>>n; cout<<setiosflags(ios::fixed)<<setprecision(2)<<n<<endl; float i=1
2010-02-26 16:12:00
1689
原创 C++中IO流的基本操作
#include#include#include#includeusing namespace std;int main(){ cout<<"hello flush"<<flush; cout<<"hello ends"<<ends; cout<<"hello endl"<<endl; /* //test cin.clear() && c
2010-02-26 16:10:00
1144
1
原创 折半插入排序算法
//折半插入排序算法void BiInsertSort(int *Data,int n){ int i,j,low,high,mid,temp; for(i=1;i<n;i++)//先确定第i个元素应插入的位置 { temp=Data[i]; low=0,high=i-1; while(low<=high) { mid=(low+high)/2;
2010-02-26 16:06:00
919
原创 排序算法之简单排序
//冒泡排序算法void BubbleSort(int *Data,int n) { int i,j,temp; bool exchange; for(i=n-1,exchange=true;i>0 && exchange;i-- ) { for(j=0,exchange=false;j<i;j++) { if(Data[j+1]<Data[j
2010-02-26 16:03:00
815
原创 八皇后问题的C语言实现
问题就不描述了,直接上代码: #includeint chess[8][8]={0};int a[8],b[15],c[15];int sum=0; //统计所有摆法void PutQueen(int n){ int col,i,j; for(col=0;col<8;col++
2010-02-26 15:58:00
17303
原创 写个简单的makefile
有如下三个文件,我们以此来写个基本的makefile test.h#ifndef TEST_H_H#define TEST_H_H#include#include#includeclass Test{public: void vector_insert(std::string&); void vector_print();private: s
2010-02-20 12:25:00
788
原创 画线算法的实现
众所周知,VC++中画图算法封装在一个重要的类CDC中。。。基本的像LineTo();MoveTo()等,要说到画线,其实底层的算法也不是很难。。。在这里贴几个代码分享一下!(这里只在MFC的view类OnDraw函数实现)1、DDA(数值微分)法:void CDDALineView::OnDraw(CDC* pDC){ CDDALineDoc* pDoc = G
2010-02-19 21:37:00
3241
2
C++面向对象多线程编程
2017-07-28
C Primer Plus(第五版)中文版
2017-07-28
Erlang程序设计(中文版)
2017-07-28
RESTful Web APIs
2017-07-28
MySQL技术内幕:InnoDB存储引擎-姜承尧
2017-07-28
流畅的Python(Fluent Python)
2017-07-28
Visual C++ MFC入门教程
2010-02-03
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人