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

免费推广平台网站无极网站无极城市在线

免费推广平台网站,无极网站无极城市在线,网络管理员证书含金量,装修公司网站模版目录 链表的概念和结构 单链表的实现 申请新结点 打印 尾插 头插 尾删 头删 ​编辑 查找 在pos位置前插入元素 在pos位置后插入元素 删除pos位置的元素 删除pos位置之后的位置的元素​编辑 完整代码 SListNode.h SListNode.c 链表的概念和结构 链表是一种物理存储…目录 链表的概念和结构 单链表的实现 申请新结点 打印 尾插 头插 尾删 头删 ​编辑 查找 在pos位置前插入元素  在pos位置后插入元素 删除pos位置的元素  删除pos位置之后的位置的元素​编辑 完整代码 SListNode.h SListNode.c 链表的概念和结构 链表是一种物理存储上非连续非顺序的存储结构数据元素的逻辑顺序是通过链表中的指针链接次序实现的 链式结构逻辑连续物理不一定连续 单链表的实现 无头 单向 非循环链表 申请新结点 打印 尾插 头插 尾删 头删 查找 在pos位置前插入元素  ​​​​ 在pos位置后插入元素 删除pos位置的元素  删除pos位置之后的位置的元素 完整代码 SListNode.h #include stdio.h #include stdlib.h #include assert.htypedef int SLTDataType;typedef struct SListNode {SLTDataType data;struct SListNode* next; }SLTNode;SLTNode* BuySListNode(SLTDataType x); //申请一个结点void SListNodePrint(SLTNode* plist); //打印void SListPushBack(SLTNode** pplist, SLTDataType x); //尾插void SListPushfront(SLTNode** pplist, SLTDataType x); //头插void SListPopBack(SLTNode** pplist); //尾删void SListPopfront(SLTNode** pplist); //头删SLTNode* SListFind(SLTNode* plist, SLTDataType x); //查找void SListInsert(SLTNode** pplist, SLTNode* pos, SLTDataType x); //在pos位置前插入元素void SListInsertAfter(SLTNode* pos, SLTDataType x); //在pos位置后插入元素void SListErase(SLTNode** pplist, SLTNode* pos); //删除pos位置前的元素void SListEraseAfter(SLTNode* pos); //删除pos位置之后的位置的元素 SListNode.c #define _CRT_SECURE_NO_WARNINGS 1#include SListNode.hSLTNode* BuySListNode(SLTDataType x) //申请一个新结点 {SLTNode* newnode (SLTNode*)malloc(sizeof(SLTNode));if (newnode NULL){perror(malloc failed);exit(-1);}newnode-data x;newnode-next NULL;return newnode; }void SListNodePrint(SLTNode* plist) //打印 {SLTNode* cur plist;while (cur){printf( %d -, cur-data);cur cur-next;}printf(NULL);printf(\n); }void SListPushBack(SLTNode** pplist, SLTDataType x) //尾插 {assert(pplist);SLTNode* newnode BuySListNode(x);if (*pplist NULL){*pplist newnode;}else{SLTNode* tail *pplist;while (tail-next ! NULL){tail tail-next;}tail-next newnode;} }void SListPushfront(SLTNode** pplist, SLTDataType x) //头插 {assert(pplist);SLTNode* newnode BuySListNode(x);newnode-next *pplist;*pplist newnode;}void SListPopBack(SLTNode** pplist) //尾删 {assert(pplist);assert(*pplist);//空链表//一个结点if ((*pplist)-next NULL){free(*pplist);*pplist NULL;}//一个以上结点else{SLTNode* tail *pplist;while (tail-next-next ! NULL){tail tail-next;}free(tail-next);tail-next NULL;} }void SListPopfront(SLTNode** pplist) //头删 {assert(pplist);assert(*pplist);SLTNode* cur *pplist;*pplist (*pplist)-next;free(cur); }SLTNode* SListFind(SLTNode* plist, SLTDataType x) //查找 {SLTNode* cur plist;while (cur){if (cur-data x){return cur;}cur cur-next;}return NULL; }void SListInsert(SLTNode** pplist, SLTNode* pos, SLTDataType x) //在pos位置前插入元素 {assert(pplist);assert(pos);if (*pplist pos){SListPopfront(pplist, x);}else{SLTNode* cur *pplist;while (cur-next ! pos){cur cur-next;}SLTNode* newnode BuySListNode(x);newnode-next cur-next;cur-next newnode;} }void SListInsertAfter(SLTNode* pos, SLTDataType x) //在pos位置后插入元素 {assert(pos);SLTNode* newnode BuySListNode(x);newnode-next pos-next;pos-next newnode; }void SListErase(SLTNode** pplist, SLTNode* pos) //删除pos位置的元素 {assert(pplist);assert(pos);if (*pplist pos){SListPopfront(pplist);}else{SLTNode* cur *pplist;while (cur-next-next pos){cur cur-next;}cur-next pos-next;free(pos);pos NULL;} }void SListEraseAfter(SLTNode* pos) //删除pos位置之后的位置的元素 {assert(pos);assert(pos-next);SLTNode* cur pos-next;pos-next cur-next;free(cur);cur NULL; }
http://www.dnsts.com.cn/news/247064.html

相关文章:

  • 郑州公司建网站门户网站开发步骤
  • 京东网站建设有哪些优点软件开发的五个阶段
  • 网站怎么做移动端的wordpress站点前台请求数过多
  • 上海做网站找哪家好编程项目实例网站
  • 深圳市住房和建设局网站做充气气模产品一般去哪些网站
  • 做阿里巴巴网站需要多少钱做内容网站 用什么模版
  • 外贸展示型网站建设外贸网站怎么找客户
  • 网站开发尾款如何做账网页开发语言有哪几种
  • 建个网站 网页空间多少wordpress左右滑动页面
  • 广东外贸型网站建设无锡有网页制作公司吗
  • 灯饰 东莞网站建设网站做第三方支付
  • 萍乡网站推广装修设计合同标准范本
  • 响应式网站和展示式区别网页设计企业宣传网站
  • 网站建设与管理实务wordpress后台字体
  • 国外创意网站设计网站怎样投放广告位
  • 金华网站制作案例vps做网站教程
  • 上海好的网站有哪些苏州做企业网站建设
  • 直播类型网站开发网站 带后台
  • 做网站商城必须要买空间吗做网站做得好的公司有哪些
  • 受欢迎的网站建设案例做杂志的网站有哪些内容
  • dede搭建网站教程网站备案怎么备案
  • 已被网站管理员设置拦截wordpress my visitors
  • 网站开发类的合同范本网站开发项目实战视频
  • 评价校园网站建设范例上海建筑公司黄页
  • 延庆上海网站建设六安马启兵胡冰倩婚礼
  • 成都哪家公司做网站比较好wordpress 发布分离
  • 福州网站建设工作青岛网站公司
  • 杭州萧山做网站注册公司的流程图
  • 建设电商网站多少钱找效果图的网站哪个好
  • 视频网站怎么搭建用shopify 做网站