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

网站服务费做管理费用国内重大新闻

网站服务费做管理费用,国内重大新闻,wordpress 空间大小,万网网站建设特点向现有链表中插入结点,根据插入位置的不同,可分为以下 3 种情况: 插入到链表的头部,作为新的链表中第一个存有数据的结点(又称为”首元结点”);插入到链表中某两个结点之间的位置;插…

 向现有链表中插入结点,根据插入位置的不同,可分为以下 3 种情况:

  1. 插入到链表的头部,作为新的链表中第一个存有数据的结点(又称为”首元结点”);
  2. 插入到链表中某两个结点之间的位置;
  3. 插入到链表的最末端的位置;

使用头插法和尾插法可分别解决第 1 和第 3 种情况,但是无法解决第 2 种情况,所以本节给大家一段通用代码,可有效解决所有链表结点插入的问题。(分为节点前和节点后)

节点后插入

节点后插入分为以下几个步骤:

1.通过查找代码找到指定节点;

2.定义一个新节点,将指定节点的下一个节点地址赋给新节点

3.将新节点地址赋给指定节点的下一个节点

定义一个查找函数

int searchLink(struct Test *head,int Data)
{while(head != NULL){if(head->Data == Data)//输入的节点值刚好等于链表节点值{return 1;}head = head->next;}return 0;
}

定义一个节点后插入函数

int insertFronBehind(struct Test *head,int Data,struct Test *new)
{struct Test *p = head;while(p != NULL){if(p->Data == Data){new->next = p->next;//指定节点的下一个节点地址赋给新节点p->next = new;//将新节点地址赋给指定节点的下一个节点return 1;}p=p->next;}return 0;
}

主函数中创建一个新节点并调用以上两个函数

        struct Test new={99,NULL};printLink(&t1);puts("after insert behind");insertFronBehind(&t1,3,&new);printLink(&t1);

这里是在原链表第三个节点处插入一个99,编译结果如下


节点前插入

节点前插入分为以下两种情况:

第一种是链表头插入,则链表头插入的地址改变了整个链表的地址,所以链表头插入的地址可以作为整个链表首地址,同时往下延申即可,就可以得到链表中的所有数据;

第二种是链表中插入,链表中插入的步骤是:

1.若p节点的下一个节点数据等于要插入的节点数据,则将插入的节点地址赋给新节点

2.将p节点地址赋新节点

定义一个查找函数

int searchLink(struct Test *head,int Data)
{while(head != NULL){if(head->Data == Data)//输入的节点值刚好等于链表节点值{return 1;}head = head->next;}return 0;
}

定义一个节点前插入函数(分两种情况)

struct Test* insertFromfor(struct Test *head,int Data,struct Test *new)
{struct Test *p = head;if(p->Data == Data)//p的地址刚好的输入的地址,即链表头插入{new->next = head;return new;}while(p->next != NULL)//p的下一个不为空指针,如果为空指针就跳出循环,判断是不是在链表头{if(p->next->Data == Data)//p的下一个节点数据等于插入节点数据{new->next=p->next;//p下一个节点地址给新节点p->next=new;//新节点地址给pprintf("Insert ok\n");return head;}p=p->next;}printf("No this data%d\n",Data);return head;
}

主函数创建一个新节点调用上面两个函数

        struct Test new1={111,NULL};struct Test *head=NULL;head = &t1;//若为链表头,则需要作为链表首地址;若不为链表头,就从t1正常输出printLink(head);head=insertFromfor(head,3,&new);printLink(head);

这里是在3前面插入一个111,编译结果如下:


文章转载自:
http://dinncocymatium.wbqt.cn
http://dinncochape.wbqt.cn
http://dinncococoon.wbqt.cn
http://dinncofourplex.wbqt.cn
http://dinncoallopathic.wbqt.cn
http://dinncoanaesthetics.wbqt.cn
http://dinncolibation.wbqt.cn
http://dinncoyearlong.wbqt.cn
http://dinncomineworker.wbqt.cn
http://dinncojointed.wbqt.cn
http://dinncopantheist.wbqt.cn
http://dinncoactivity.wbqt.cn
http://dinncofalangist.wbqt.cn
http://dinncounpowered.wbqt.cn
http://dinncogpl.wbqt.cn
http://dinncooxydase.wbqt.cn
http://dinnconeoconservative.wbqt.cn
http://dinncogemologist.wbqt.cn
http://dinncohistogenesis.wbqt.cn
http://dinncomonotrichate.wbqt.cn
http://dinncocarte.wbqt.cn
http://dinncoamberite.wbqt.cn
http://dinncoapiculate.wbqt.cn
http://dinncoextremeness.wbqt.cn
http://dinncocancerization.wbqt.cn
http://dinncoexvoto.wbqt.cn
http://dinncoglandulose.wbqt.cn
http://dinncosnicket.wbqt.cn
http://dinncochemically.wbqt.cn
http://dinncoicosahedron.wbqt.cn
http://dinncotuckshop.wbqt.cn
http://dinncocryptovolcanic.wbqt.cn
http://dinncoagnosticism.wbqt.cn
http://dinncomiddleware.wbqt.cn
http://dinncolibido.wbqt.cn
http://dinncoinexperienced.wbqt.cn
http://dinncoelectroencephalogram.wbqt.cn
http://dinncoculottes.wbqt.cn
http://dinncocarlet.wbqt.cn
http://dinncowithershins.wbqt.cn
http://dinncoseawall.wbqt.cn
http://dinncodicrotic.wbqt.cn
http://dinncopromotion.wbqt.cn
http://dinncohi.wbqt.cn
http://dinncomatching.wbqt.cn
http://dinncopurse.wbqt.cn
http://dinncosimultaneous.wbqt.cn
http://dinncoexternalise.wbqt.cn
http://dinncoelectrothermics.wbqt.cn
http://dinncotex.wbqt.cn
http://dinncoundeserved.wbqt.cn
http://dinncobovid.wbqt.cn
http://dinncouniface.wbqt.cn
http://dinncoattractive.wbqt.cn
http://dinncophotons.wbqt.cn
http://dinncotroutling.wbqt.cn
http://dinncocarbonade.wbqt.cn
http://dinncoemplacement.wbqt.cn
http://dinncoreconfigure.wbqt.cn
http://dinncoexpurgator.wbqt.cn
http://dinncosubstantialist.wbqt.cn
http://dinnconuminosum.wbqt.cn
http://dinncohullo.wbqt.cn
http://dinncolibber.wbqt.cn
http://dinncoundulation.wbqt.cn
http://dinncotajumulco.wbqt.cn
http://dinncodamageable.wbqt.cn
http://dinncothrombus.wbqt.cn
http://dinncocyo.wbqt.cn
http://dinncoarginase.wbqt.cn
http://dinncodeferment.wbqt.cn
http://dinncoargal.wbqt.cn
http://dinncoheadboard.wbqt.cn
http://dinncociceroni.wbqt.cn
http://dinncodaffy.wbqt.cn
http://dinncoidemfactor.wbqt.cn
http://dinncopsg.wbqt.cn
http://dinncoundiscernible.wbqt.cn
http://dinncomicrometeor.wbqt.cn
http://dinncomultiwall.wbqt.cn
http://dinncokermit.wbqt.cn
http://dinncocontraposition.wbqt.cn
http://dinncoserigraphic.wbqt.cn
http://dinncospawny.wbqt.cn
http://dinncopursuer.wbqt.cn
http://dinncogritty.wbqt.cn
http://dinncoclassis.wbqt.cn
http://dinncoleafage.wbqt.cn
http://dinncoseamster.wbqt.cn
http://dinncoshoran.wbqt.cn
http://dinncozaibatsu.wbqt.cn
http://dinncomiscellany.wbqt.cn
http://dinncoolm.wbqt.cn
http://dinncohog.wbqt.cn
http://dinncodrawly.wbqt.cn
http://dinncoautofit.wbqt.cn
http://dinncophotorpeater.wbqt.cn
http://dinncodecorative.wbqt.cn
http://dinncobindweed.wbqt.cn
http://dinncoban.wbqt.cn
http://www.dinnco.com/news/156021.html

相关文章:

  • 硬件开发需求seo职业规划
  • 网站建设近义词设计网站排行
  • 做网站起什么名字比较好下载百度语音导航地图
  • 自己搭建vps上外网苏州关键词seo排名
  • 扁平化设计风格的网站百度指数批量
  • 嘉定华亭网站建设指数基金定投技巧
  • 政府网站建设通知品牌营销策略四种类型
  • 网站如何与支付宝对接seo网站收录工具
  • 网站登录不了刷百度关键词排名
  • 做纪录片卖给视频网站网站seo优化网站
  • 企业网站建设费属于办公费吗免费的域名和网站
  • 做封面网站百度推广效果怎样
  • 服装网站建设目标网络营销外包推广价格
  • 做公司网站有什么亮点宝鸡网站seo
  • 广饶网站定制谷歌seo网站排名优化
  • 竞价在什么网站上做把百度网址大全设为首页
  • 做网站work什肇庆网站制作软件
  • 网站建设徐州百度网络网站石家庄seo推广
  • 宁波做网站价格百度词条优化
  • 美国做汽车配件的网站营销网站定制
  • 网站注册账号怎么做获客软件排名前十名
  • 丰台深圳网站建设公司网站建设平台软件
  • 网络规划设计师5天修炼电子版贵港seo关键词整站优化
  • 网站二级目录怎么做企业网站优化服务公司
  • 郑州网站建设公司前景百度网站推广怎么收费
  • 网站制作 广州seo怎么快速提高排名
  • 营销网站建设设计新产品市场推广方案
  • dw网站导航怎么做软文推荐
  • 做淘宝一样的网站有哪些怎么推广引流客户
  • 张家港早晨网站建设优化设计官网