上一页 1 2 3 4 5 6 7 8 9 10 ··· 15 下一页

2014年11月11日

tire树

摘要: #pragma once #include using namespace std;#define MAX_CHAR 26struct node { bool isWord; node* next[MAX_CHAR]; node() { isWord = false; for(int i = 0... 阅读全文

posted @ 2014-11-11 15:07 kangbry 阅读(131) 评论(0) 推荐(0) 编辑

修改版本号

摘要: # !/bin/bash rc=$1exe=$2if [ ! -e "$rc" ]; then echo "rc not exist" exit fi if [ ! -e "$exe" ]; then echo "exe not exist" exit fi ver=`c... 阅读全文

posted @ 2014-11-11 13:48 kangbry 阅读(230) 评论(0) 推荐(0) 编辑

100亿个数取前1w名

摘要: #include #include #include #include #include #include static unsigned int BUF_PAGES; /* 缓冲区有多少个page */static unsigned int PAGE_SIZE; ... 阅读全文

posted @ 2014-11-11 13:30 kangbry 阅读(178) 评论(0) 推荐(0) 编辑

2014年11月10日

洗牌算法

摘要: #include#include#includevoid swap(int &a,int &b){ int c; c = a; a = b; b = c;}void display(int card[],int n){ int i; for(i=0;i<n;i++) printf("%d ",ca... 阅读全文

posted @ 2014-11-10 22:53 kangbry 阅读(122) 评论(0) 推荐(0) 编辑

2014年11月9日

排名算法

摘要: #include#includeusing namespace std;struct BinaryTree{ int count;// 该节点的孩子总数 int from_score; int to_score; BinaryTree* left; BinaryTree* right; Binary... 阅读全文

posted @ 2014-11-09 23:58 kangbry 阅读(130) 评论(0) 推荐(0) 编辑

kmp算法

摘要: kmp算法//计算偏移值void get_next(const char pat[], int next[]) { memset(next,0,sizeof(next)); int i=-1,j=0;next[0]=-1; while(j < strlen(pat)) { if(i==-1||pa... 阅读全文

posted @ 2014-11-09 00:39 kangbry 阅读(140) 评论(0) 推荐(0) 编辑

冒泡排序

摘要: void sort(int* a, int size){ for (int i = 0; i a[j]) { int t = a[j + 1 ]; a[j + 1] = a[j]; ... 阅读全文

posted @ 2014-11-09 00:22 kangbry 阅读(103) 评论(0) 推荐(0) 编辑

2014年11月8日

算法复杂度

摘要: 算法复杂度分为时间复杂度和空间复杂度。其作用:时间复杂度是指执行算法所需要的计算工作量;而空间复杂度是指执行这个算法所需要的内存空间按数量级递增排列,常见的时间复杂度有:常数阶O(1)对数阶O(log2n)线性阶O(n),线性对数阶O(nlog2n)平方阶O(n^2)立方阶O(n^3)k次方阶O(n... 阅读全文

posted @ 2014-11-08 16:51 kangbry 阅读(168) 评论(0) 推荐(0) 编辑

2014年11月7日

二叉树遍历

摘要: #include #include #include using namespace std;typedef char DataType;typedef struct BiTNode{ DataType data; struct BiTNode *lchild,*rchild;}BITNode;ty... 阅读全文

posted @ 2014-11-07 00:12 kangbry 阅读(148) 评论(0) 推荐(0) 编辑

2014年11月5日

hash查找

摘要: #include#include#includeusing namespace std; #define HASHSIZE 7#define NULLKEY -32768 struct HashTable{ int *elem; int count;};void init(HashTable* ha... 阅读全文

posted @ 2014-11-05 22:00 kangbry 阅读(167) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 10 ··· 15 下一页

导航