#pragmaonce
#include<stdio.h>
#include<assert.h>
#include<malloc.h>
#include<string.h>
typedefintDateType;
typedefstructSeqList
{
DateType*_array;
size_t_size;
size_t_capacity;
}SeqList;
voidInitSeqList(SeqList*pSeq)
{
assert(pSeq);
..
分类:
其他好文 时间:
2015-11-21 22:51:56
阅读次数:
389
顺序表功能补全,二分查找实现,优化。选择排序及优化方式
分类:
其他好文 时间:
2015-11-21 21:02:20
阅读次数:
140
从这一篇开始要介绍算法中的查找技术了。查找在我们生活中无处不在,比如查公交,查机票,查酒店。。。这些都是查找。首先来看一下查找技术的分类。如下图:1.顺序查找那么这篇要总结的是顺序表中的顺序查找技术。什么是顺序查找呢?顺序查找的原理很简单,就是遍历整个列表,逐个进行记录的关键字与给定值比较,若某个记...
分类:
其他好文 时间:
2015-11-14 22:06:59
阅读次数:
403
#pragmaonce
#include<stdio.h>
#include<assert.h>
#include<malloc.h>
#include<string.h>
typedefintDateType;
typedefstructSeqList
{
DateType*_array;
size_t_size;
size_t_capacity;
}SeqList;
voidInitSeqList(SeqList*pSeq)
{
assert(pSeq);..
分类:
其他好文 时间:
2015-11-13 23:45:35
阅读次数:
463
#include<stdio.h>#include<string.h>#include<memory.h>#include<assert.h>#defineMAX_SIZE100typedefintDataType;typedefstructSeqList{DataTypearry[MAX_SIZE];size_tsize;}SeqList;//定义一个结构体顺序表voidInitSeqList(SeqList*pSeq){memset(pS..
分类:
其他好文 时间:
2015-11-13 06:41:31
阅读次数:
248
这个程序里包括了对顺序表的基本操作:创建、显示、插入、删除、查找#include#define MaxLen 50typedef int elemtype;typedef elemtype sqlist[MaxLen];int create(sqlist A){ int i,n; pri...
分类:
其他好文 时间:
2015-11-11 07:44:10
阅读次数:
282
上一篇最后给出了用递归完成字符串逆置的代码,但是没有分析它的具体算法,今天做了如‘abcde‘字符串递归翻转的图跟大家分享(画的比较烂,具体思路还是有的,详情见附件)这里的递归调用没有出现在函数末尾,二前面几个递归都出现在函数末尾,所以说递归可以分为在函数末尾的递..
分类:
其他好文 时间:
2015-11-09 14:04:53
阅读次数:
198
题目:有一个字符数组的内容为:"studentaami",请你将数组的内容改为"iamastudent".要求:不能使用库函数。只能开辟有限个空间(空间个数和字符串的长度无关)。题目分析:由于题目中给定的字符串中包含空格字符,就不能简单的将数组的内容整个进行逆置,题目中要求不能使用库函..
分类:
编程语言 时间:
2015-11-01 19:44:13
阅读次数:
193
#include<stdio.h>
//#include<assert.h>
voidmy_reverse(char*left,char*right)
{
//assert(left);
//assert(right);用以处理指针函数为空,保证有效
while(left<right)
{
chartmp=*left;//借助中间变量实现逆置
*left=*right;
*right=tmp;
left++;
right--;
}..
分类:
编程语言 时间:
2015-10-31 18:46:04
阅读次数:
548
#include<stdio.h>
#include<assert.h>
/*求字符串长度*/
intmy_strlen(char*str)
{
assert(str);
intcount=0;
while(*str)
{
count++;
str++;
}
returncount;
}
/*逆置函数*/
char*reverse_str(char*start,char*end)
{
char*ret=start;
chartemp;
whi..
分类:
编程语言 时间:
2015-10-31 18:43:19
阅读次数:
200