摘要:
int comlen(const char* str1,const char* str2){ assert((str1!=0)&&(str2!=0)); int len=0; while(*str1!='\0'&&*str2!='\0'&&*str1++==*str2++){ len++; } return len;}bool less(char* str1,char* str2){ return strcmp(str1,str2)<=0;}/*后缀数组法*/void longestRepeatedSubst 阅读全文
posted @ 2012-08-13 20:39
freewater
阅读(265)
评论(0)
推荐(0)
摘要:
1 public static void insertSort(int[] a){ 2 for(int j=1;j<a.length;j++){ 3 int key=a[j]; 4 int i=j-1; 5 while(i>=0&&key<a[i]){ 6 a[i+1]=a[i]; 7 i--; 8 } 9 a[i+1]=key; 10 } 11 } 1... 阅读全文
posted @ 2012-08-13 20:08
freewater
阅读(263)
评论(0)
推荐(0)
摘要:
1 char* myitoa(int x,char* str){ 2 assert(str!=0); 3 4 int negPos=-1; 5 if(x<0){ 6 negPos=0; 7 str[negPos]='-'; 8 x*=-1; 9 } 10 11 int i,j; 12 i=j=negPos+1; 13 do{ 14 str[j++]=x%10+'0'; 15 x/=10; 16 }while(x!=0); 17 ... 阅读全文
posted @ 2012-08-13 20:07
freewater
阅读(191)
评论(0)
推荐(0)
摘要:
#ifndef PRIORITYQUEUE_H#define PRIORITYQUEUE_Htemplate <class T>class PriorityQueue{private: T *x; int size,capacity; void swap(int i,int j) { T t=x[i];x[i]=x[j];x[j]=t; }public: PriorityQueue(int initCapacity) { capacity=initCapacity; x=new int[capacity+1];... 阅读全文
posted @ 2012-08-13 20:07
freewater
阅读(138)
评论(0)
推荐(0)

浙公网安备 33010602011771号