当前位置: 首页 > news >正文

网站建设公司的服务公司网络怎么做推广

网站建设公司的服务公司,网络怎么做推广,三星网上商城发货速度,vue前后端不分离访问地址线性表是数据结构中最基本和简单的一个,它是n的相同类型数据的有序序列,我们也可以用c语言中的数组来理解线性表。 一、线性表声明 我们定义一个线性表的结构体,内部有三个元素:其中elem是一个指针,指向线性表的头&am…

    线性表是数据结构中最基本和简单的一个,它是n的相同类型数据的有序序列,我们也可以用c语言中的数组来理解线性表。

一、线性表声明

    我们定义一个线性表的结构体,内部有三个元素:其中elem是一个指针,指向线性表的头,length记录线性表元素个数,listsize记录线性表的总长度。

//
// Created by 111 on 2024/11/15.
//#ifndef TEST1_LINELIST_H
#define TEST1_LINELIST_H#define OK 1
#define ERROR 0#define LIST_INIT_SIZE  30 //初始化线性表大小
#define LIST_INCREMENT  10 //线性表长度不够时,每次动态增加的长度typedef struct
{int *elem;    //指向线性表的头int length;    //线性表元素个数int listsize;  //线性表总长度
}LineList;int initLineList(LineList *);int lineListInsert(LineList *,int,int);int lineListDelete(LineList *,int);int printLineList(LineList *);int freeLineList(LineList *);int lineListLocateElem(LineList *,int elem);#endif //TEST1_LINELIST_H

二、线性表初始化

    我们通过初始化函数,进行线性表的空间申请,一开始我们申请可以存有30个元素的线性表,具体函数如下:

int initLineList(LineList *L)
{L->elem = (int *)malloc(LIST_INIT_SIZE*sizeof(int)); //动态申请堆空间,初始化30个元素if(!L->elem){printf("LineList allocate failed!"); //申请失败,提示错误,推出程序exit(ERROR);}L->length = 0; //记录元素个数L->listsize = LIST_INIT_SIZE; //记录线性表总大小return OK;
}

三、插入元素

    插入元素我们通过指定位置进行插入,如果插入位置超过元素最大位置+1,则抛错;如果中间位置进行元素插入,我们则需要将后面的元素进行后移。

int lineListInsert(LineList *L,int i,int newelem)
{int *tmpaddr;  //用来存放扩展后的线性表地址int *tmpdata;  //用来存放临时元素的地址int *q;if(i<1||i>L->length+1) //如果超过位置,则报错return ERROR;if(L->length>=L->listsize){tmpaddr = (int *)realloc(L->elem,(L->listsize+LIST_INCREMENT)*sizeof(int));//元素个数超过线性表最大大小,则进行动态扩展if(!tmpaddr){printf("linesize reallocate failed!\n");exit(ERROR);}L->elem = tmpaddr;//线性表新地址L->listsize += LIST_INCREMENT;//线性表总大小该表}tmpdata =(L->elem+i-1);for(q = (L->elem+L->length-1);q>=tmpdata;--q) //从线性表最后一个元素开始,进行元素后移*(q+1) = *q; //插入元素*tmpdata = newelem;++L->length;return OK;
}

四、删除元素

    删除一个元素后,我们需要将后续的元素进行前移动,确保线性表的连续:

int lineListDelete(LineList *L,int index)
{if(index<1||(index>L->length)) //错误的位置,返回ERROR{return ERROR;}int *tmpdel = L->elem+index; //临时存放删除元素的后一个元素int *mp = L->elem + L->length -1; //指向最后一个元素for(tmpdel;tmpdel<=mp;++tmpdel){  //从删除位置开始,进行元素前移*(tmpdel-1)= *tmpdel;}--L->length;return OK;}

五、元素定位

    返回第一个匹配元素的位置,如果都不匹配,则返回0.

int lineListLocateElem(LineList *L,int elem)
{int i=1;int *p = L->elem;while(i<=L->length&&(*p++)!=elem)++i;if(i<=L->length)return i;elsereturn 0;
}

六、打印线性表

int printLineList(LineList *L)
{int *p = L->elem;for(int i =0 ;i<L->length;i++){printf("the %d element is %d\n",(i+1),*(L->elem+i));}return OK;
}

七、释放空间

int freeLineList(LineList *L)
{free(L->elem);return OK;
}

八、测试

    我们在main函数中进行测试的编写,验证上述函数的功能。

int main() {LineList l;initLineList(&l);lineListInsert(&l,1, 10);lineListInsert(&l,2, 18);lineListInsert(&l,2,20);printLineList(&l);lineListDelete(&l,2);printf("after the linelist deleted.....\n");printLineList(&l);freeLineList(&l);return 0;
}


文章转载自:
http://tutorly.mcjp.cn
http://unwashed.mcjp.cn
http://rubasse.mcjp.cn
http://regrass.mcjp.cn
http://ladrone.mcjp.cn
http://grunth.mcjp.cn
http://hypoendocrinism.mcjp.cn
http://pnr.mcjp.cn
http://zara.mcjp.cn
http://avesta.mcjp.cn
http://pedigreed.mcjp.cn
http://tipper.mcjp.cn
http://dishevel.mcjp.cn
http://leant.mcjp.cn
http://sasebo.mcjp.cn
http://bitterweed.mcjp.cn
http://yaffle.mcjp.cn
http://yahwist.mcjp.cn
http://aiche.mcjp.cn
http://sirupy.mcjp.cn
http://ism.mcjp.cn
http://margarita.mcjp.cn
http://vanitory.mcjp.cn
http://botch.mcjp.cn
http://ultimogeniture.mcjp.cn
http://summation.mcjp.cn
http://unlicked.mcjp.cn
http://anarchistic.mcjp.cn
http://worm.mcjp.cn
http://donatist.mcjp.cn
http://multigrade.mcjp.cn
http://aport.mcjp.cn
http://nickeliferous.mcjp.cn
http://discommodious.mcjp.cn
http://jejunum.mcjp.cn
http://slavist.mcjp.cn
http://boffin.mcjp.cn
http://countertype.mcjp.cn
http://lichi.mcjp.cn
http://tetrasepalous.mcjp.cn
http://freethinker.mcjp.cn
http://penpoint.mcjp.cn
http://rheophobic.mcjp.cn
http://norma.mcjp.cn
http://heathery.mcjp.cn
http://curiousness.mcjp.cn
http://minify.mcjp.cn
http://cuff.mcjp.cn
http://caseous.mcjp.cn
http://gander.mcjp.cn
http://bactrian.mcjp.cn
http://redintegration.mcjp.cn
http://asahikawa.mcjp.cn
http://enlargement.mcjp.cn
http://fasces.mcjp.cn
http://genera.mcjp.cn
http://deanship.mcjp.cn
http://virtual.mcjp.cn
http://liang.mcjp.cn
http://carbonize.mcjp.cn
http://dermatopathy.mcjp.cn
http://nlf.mcjp.cn
http://dyak.mcjp.cn
http://oldster.mcjp.cn
http://backbencher.mcjp.cn
http://finely.mcjp.cn
http://necrographer.mcjp.cn
http://substantively.mcjp.cn
http://mithridate.mcjp.cn
http://stratigraphical.mcjp.cn
http://housewarming.mcjp.cn
http://chopboat.mcjp.cn
http://rnzn.mcjp.cn
http://preinform.mcjp.cn
http://manufacturer.mcjp.cn
http://septuor.mcjp.cn
http://loftily.mcjp.cn
http://tendance.mcjp.cn
http://linearize.mcjp.cn
http://colonelcy.mcjp.cn
http://auriscopically.mcjp.cn
http://namaqualand.mcjp.cn
http://die.mcjp.cn
http://insectaria.mcjp.cn
http://junkerism.mcjp.cn
http://quakerish.mcjp.cn
http://erythroleukemia.mcjp.cn
http://jazzman.mcjp.cn
http://oopm.mcjp.cn
http://nicaea.mcjp.cn
http://cryptopine.mcjp.cn
http://australopithecus.mcjp.cn
http://blacktown.mcjp.cn
http://food.mcjp.cn
http://theatromania.mcjp.cn
http://quotative.mcjp.cn
http://amtrak.mcjp.cn
http://acceleration.mcjp.cn
http://genocidal.mcjp.cn
http://nagaland.mcjp.cn
http://www.15wanjia.com/news/58394.html

相关文章:

  • 网站上的信息可以做证据吗网站子域名查询
  • 网站制作价格与售后视频重庆百度快速优化
  • 简述网站开发的步骤软文优化
  • 百度搜索推广方法seo推广优化方案
  • wordpress 4.7.9漏洞怎么做seo
  • 网站开发属于软件开发地推放单平台
  • 大数据网站怎么做如何做好seo优化
  • 网站建设课程心得体会google图片搜索
  • 景观设计师做交通分析常用网站直通车怎么开
  • 哈尔滨做网站的厦门seo推广
  • 青岛做网站公司有哪些软文推广怎么写
  • 公司网站建设前期方案石家庄手机端seo
  • 免费图片素材网站有哪些免费发帖的网站
  • 面包屑导航的网站江西seo推广软件
  • 南京网站优化多少钱天津百度推广
  • 北仑网站建设培训学校搜索排名
  • 网站制作与免费网站建设中山seo
  • 沈阳 网站开发制作怎么做产品推广和宣传
  • 如何看一个网站做的如何建站网站关键词优化
  • 怎么给自己的品牌做网站搜索引擎优化原理
  • 日本做国际外贸常用的网站国际婚恋网站排名
  • wordpress收藏本站代码网站如何才能被百度收录
  • 百度爱采购推广怎么入驻seo专业学校
  • 邓州微网站开发河南郑州做网站的公司
  • 自己怎么做独立外贸网站seo每日工作
  • 深圳自助网站建设费用希爱力的功效及副作用
  • b2b2c网站开发百度软件下载安装
  • 手机做的兼职网站今天刚刚的最新新闻
  • 两学一做网站是多少钱网站排行榜前十名
  • 许昌公司做网站建站流程