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

做网站注册页面模板wordpress更换主题

做网站注册页面模板,wordpress更换主题,广州seo优化外包公司,阳江网双向循环链表是一种较为特殊的链表#xff0c;也是一种常见的数据结构#xff0c;其头尾相连#xff0c;各节点之间可互相访问#xff0c;在单链表中#xff0c;只能依次向后访问#xff0c;无法访问上一个节点#xff0c;而双链表可以依次向下访问也可向上访问。 链表…双向循环链表是一种较为特殊的链表也是一种常见的数据结构其头尾相连各节点之间可互相访问在单链表中只能依次向后访问无法访问上一个节点而双链表可以依次向下访问也可向上访问。 链表形式 双链表有很多节点形象的依次连接在一起每个节点都由一个数据域和两个指针域构成尾指针存放着下一个节点的地址头指针存放着上一个节点的地址故而形象的使各个节点依次相连。 插入一个节点 在1、3节点之间插入节点21节点尾指针原本指向3节点改变其指向使之指向2节点2节点的头指针便指向1节点同理改变3节点的头指针指向使之指向2节点2节点的尾指针指向3节点。 删除一个节点 例如删除2节点只需将原3现2节点节点的地址赋给1节点的尾指针中3节点的头指针指向1再将原2即删除的节点节点的指针域释放掉即可 头插 循环双链表的链表头一般没有数据且一般保持这个位置不动所以访问数据是从第二个节点开始如果在链表头后一直插入数据则第二个节点一直都是新数据所以其实是对双链表进行的是前插操作。 尾插 如果在链表头插入新数据那么出现在链表头前面的都是新数据所以和插在链表尾是一个道理因为双向循环链表是首尾相连的。 具体代码如下 #includestdio.h #includestdlib.h #includestring.h typedef struct ListNode {struct ListNode *front;int data;struct ListNode* next; }ListNode;typedef struct List {ListNode *head; }List;void init(List* plist)//初始化 {//分配空间plist-head (ListNode*)malloc(sizeof(ListNode));//让头指针和尾指针都指向自己plist-head-front plist-head;plist-head-next plist-head; }int data_num(List* plist)//检查链表节点个数 {ListNode* tem;int i 0;for (tem plist-head-next; tem ! plist-head; tem tem-next){i;}return i;//返回链表节点个数 }void insert_front(ListNode* plist, intdata) //链表头前插 {//分配空间ListNode* cur (ListNode*)malloc(sizeof(ListNode));//记录链表头尾指针的内容,存放的是一个节点的地址即tem临时充当这个节点ListNode* tem plist-next;cur-data data;plist-next cur; //使链表头的尾指针指向新插进来的节点cur-front plist;//新插进来的节点的头指针指向链表头tem-front cur; //使tem节点的头指针指向新插进来的节点cur-next tem; //新插进来的尾指针指向tem} void forntinsert_list(List* plist, int data) //前插入一个节点 {insert_front(plist-head,data); }void insert_after(ListNode* plist, intdata) //链表头后插 {ListNode* cur (ListNode*)malloc(sizeof(ListNode));ListNode* tem plist-front; cur-data data;plist-front cur; //使链表头的头指针指向新插进来的节点cur-next plist; //新插进来的节点的尾指针指向链表头tem-next cur; //使tem节点的尾指针指向新插进来的节点cur-front tem; //新插进来的头指针指向tem }void afterinsert_list(List* plist, int data) //后插入一个节点 {insert_after(plist-head,data); }void the_insert(List *plist, int pos, int data) {int i 0;ListNode* cur (ListNode*)malloc(sizeof(ListNode));ListNode* tem plist-head;int num data_num(plist);if (pos num)//所插入数据的位置不能大于节点数因为是循环链表{printf(插入数据失败\n);return;}for (; i pos;i){tem tem-next;//找到插入新节点的位置}cur-data data;cur-next tem-next;//将tem尾指针中存放的内容赋给新节点的尾指针即新节点的尾指针代替tem的尾指针tem-next-front cur;//将原tem节点的下一个节点的头指针指向新节点cur-front tem;//将新节点的头指针指向tem节点tem-next cur;//将tem的尾指针指向新节点 }void print(List* plist) //打印 {ListNode* tem;if (plist-head NULL){printf(\n链表已销毁\n);return;}for (tem plist-head-next; tem ! plist-head; tem tem-next)//双向循环链表的遍历{printf(%d , tem-data);}printf(\n); }void del(ListNode *the_plist) //删除 {the_plist-front-next the_plist-next;//将该节点尾指针中存放的内容存放到上一个节点的尾指针中the_plist-next-front the_plist-front;//将该节点头指针中存放的内容存放到下一个节点的头指针中free(the_plist);//释放这个节点 }void del_front(List *plist) //头删 {del(plist-head-next);//删除链表头 } void del_after(List *plist) //尾删 {del(plist-head-front);//删除链表尾 }ListNode* list_reach(List* plist, int data) //查找 {ListNode* tem;for (tem plist-head-next; tem ! plist-head; tem tem-next){if (tem-data data)return tem;}return NULL; }void the_del(List *plist, int data) //删除指定的节点 {ListNode* tmp list_reach(plist, data);if (tmp)del(tmp); }void destory(List *plist) //销毁链表 {while (plist-head! plist-head-next){del_front(plist);//依次删头}free(plist-head);//释放最后一个头plist-head NULL; }int main() {//定义一个“链表头”List* first ;init(first);forntinsert_list(first,2);forntinsert_list(first,8);print(first);afterinsert_list(first,0);print(first);the_insert(first,1, 5);print(first);the_insert(first,1, 6);print(first);the_insert(first,0, 9);print(first);forntinsert_list(first,0);print(first);int k data_num(first);printf(%d个节点\n,k);the_insert(first,8, 7);print(first); del_after(first);print(first);del_front(first);print(first);the_del(first,6);print(first);system(pause);return 0; }
http://www.pierceye.com/news/334124/

相关文章:

  • 怎么给公司建网站广州互联网营销师培训
  • 用阿里云做网站注意事项绵阳的网站建设公司哪家好
  • 电商网站设计工作内容深圳国际设计学院
  • 国内界面优秀的网站科技有限公司名字叫什么好
  • 网站底部悬浮代码搭建网站的主要风险
  • 长安网站建设公司常做网站首页的文件名
  • 学网站开发的能找什么工作赣州网站设计较好的公司
  • 网站建设接单微信营销软件收费排行榜
  • 佛山网站建设公司排名佛山微网站推广哪家专业
  • 招商网站建设网设备 光速东莞网站建设
  • 网站建设公司如何wordpress用多大主机
  • 东莞网站建设规范网页美工设计(第2版)素材
  • 论文 网站建设值得推荐的深圳app外包公司
  • 建网站的电脑可以换位置吗莆田建站培训
  • 外贸必看网站离职模板网
  • 内网网站建设正能量不良网站软件下载
  • 制作手机广告的网站吉林省建设厅网站评职称系统
  • 云南建设厅网站资质证书查询自动生成app
  • 柳州正规网站制作公司大连建设厅网站
  • 北京市保障房建设投资中心网站瘫痪广州大型网站建设公司排名
  • 做电池网站的引导页室内设计联盟效果图
  • 查询备案网站成绩查询系统网站开发
  • 网站后台编辑器上传不了图片建筑工程承包网app
  • wordpress多站点插件168工程信息网
  • 网站工信部备案号没有ftp wordpress
  • 家装公司网站建设网站建立网站有免费的吗
  • 网站后台添加投票系统wordpress mip改造
  • 提升网站建设品质信息设计软件排行
  • 温州网站建设优化公司网站营销管理培训班
  • 昆明企业网站开发深圳航空公司最新官网