算法
september98
这个作者很懒,什么都没留下…
展开
-
字符串中单词反转
//求字符串长度 int strlen(char *s) { int i; for(i=0;s[i]!='\0';i++) ; return i; } //反转字符串的某一断子串 void Reverse(char *s,int ben,int end) { int len=end-ben+1; for(int i=0;i<len/2;i+转载 2012-10-25 10:35:11 · 305 阅读 · 0 评论 -
排序 算法
对于排序的算法我想先做一点简单的介绍,也是给这篇文章理一个提纲。 我将按照算法的复杂度,从简单到难来分析算法。 第一部分是简单排序算法,后面你将看到他们的共同点是算法复杂度为O(N*N)(因为没有 使用word,所以无法打出上标和下标)。 第二部分是高级排序算法,复杂度为O(Log2(N))。这里我们只介绍一种算法。另外还有几种 算法因为涉及树与堆的概念,所以这里不于讨论。转载 2012-10-25 10:30:40 · 220 阅读 · 0 评论 -
常用查找算法
//search.h包含了所有的常用查找算法 //使用顺序查找法的查找函数 //seqSearch(const int arr[],int first,int last,int target) template int seqSearch(const T arr[],int first,int last,const T& target) { int i=first; //扫描下标范围fi转载 2012-10-25 10:33:29 · 262 阅读 · 0 评论 -
源码:微软strcpy,strcat和strcmp的实现源代码
/*** *char *strcpy(dst, src) - copy one string over another * *Purpose: * Copies the string src into the spot specified by * dest; assumes enough room. * *Entry: * char * dst -转载 2012-11-28 18:44:43 · 372 阅读 · 0 评论