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

做设计的有什么网站wordpress推荐链接

做设计的有什么网站,wordpress推荐链接,西宁哪家网络公司做网站,有初中生做的网站吗目录 一. 逻辑结构图解 1. 节点中存储的值 2.逻辑实现 二. 各种功能实现 1. 创建节点函数 2. 初始化哨兵位 3. 尾插 4. 头插 5. 尾删 6. 头删 7. 打印链表值 8. 查找数据#xff0c;返回节点地址 9. 指定地址后插入节点 10. 删除指定地址节点 11. 销毁链表 三.…目录 一. 逻辑结构图解 1. 节点中存储的值 2.逻辑实现 二. 各种功能实现 1. 创建节点函数 2. 初始化哨兵位 3. 尾插 4. 头插 5. 尾删 6. 头删 7. 打印链表值 8. 查找数据返回节点地址 9. 指定地址后插入节点 10. 删除指定地址节点 11. 销毁链表 三. 完整代码 1. list.h 2. list.c 3. 测试 由于上一篇已经对链表的基本概念讲解完毕这里就不过多赘述了 一. 逻辑结构图解 1. 节点中存储的值 qrev是上一个节点的地址 data是节点中存储的数据 next是下一个节点的位置 2.逻辑实现 第一个节点为哨兵位不存储数据 二. 各种功能实现 1. 创建节点函数 ListNode* BuyListNode(DataType x) {ListNode* newnode (ListNode*)malloc(sizeof(ListNode));if (newnode NULL){exit(-1);}newnode-data x;newnode-next newnode-prev newnode;return newnode; } 2. 初始化哨兵位 由于需要改变哨兵位本身所以用二级指针 之后就不用改变哨兵位了所以不用用二级指针 void ListNodeInit(ListNode** pphead) {*pphead BuyListNode(0); }3. 尾插 void ListNodePushBack(ListNode* phead, DataType x) {ListNode* tail phead-prev;assert(phead);ListNode* newnode BuyListNode(x);newnode-prev phead-prev;newnode-next phead;tail-next newnode;//之前的尾指向现在的尾phead-prev newnode;//头的上一个改为现在的尾 } 4. 头插 void ListNodePushFront(ListNode* head,DataType x) {assert(head);ListNode* first head-next;ListNode* newnode BuyListNode(x);newnode-next head-next;newnode-prev head;first-prev newnode;head-next newnode; }5. 尾删 void ListNodePopBack(ListNode* head) {assert(head);ListNode* tailhead-prev;ListNode* newtail tail-prev;head-prev newtail;newtail-next head;free(tail);tail NULL; } 6. 头删 void ListNodePopFront(ListNode* head) {assert(head);ListNode* firsthead-next;ListNode* newfirst first-next;head-next newfirst;newfirst-prev head;free(first);first NULL; } 7. 打印链表值 void ListNodePrint(ListNode* phead) {assert(phead);ListNode* tmp phead-next;while (tmp! phead){printf(%d , tmp-data);tmp tmp-next;} } 8. 查找数据返回节点地址 ListNode* ListNodeFind(ListNode* head,DataType x) {assert(head);ListNode* tmp head-next;while (tmp!head){if (tmp-data x)return tmp;tmp tmp-next;}return NULL; } 9. 指定地址后插入节点 void ListNodeInsert(ListNode* pos, DataType x) {assert(pos);ListNode* newnext pos-next;ListNode* newnode BuyListNode(x);newnode-prev pos;newnode-next newnext;pos-next newnode;newnext-prev newnode;} 10. 删除指定地址节点 void ListNodeErase(ListNode* pos) {assert(pos);ListNode* posprev pos-prev, * posnext pos-next;posprev-next posnext;posnext-prev posprev;free(pos);pos NULL; } 11. 销毁链表 void ListNodeDestroy(ListNode* head) {assert(head);ListNode* cur head-next;while (cur ! head){ListNode* next cur-next;free(cur);cur next;} } 三. 完整代码 1. list.h #define _CRT_SECURE_NO_WARNINGS h #pragma once #includestdio.h #includestdlib.h #includeassert.htypedef int DataType;typedef struct ListNode {DataType data;struct SList* next;struct SList* prev; }ListNode;//初始化 void ListNodeInit(ListNode** pphead); //尾插 void ListNodePushBack(ListNode* head, DataType x); //打印链表 void ListNodePrint(ListNode* phead); //头插 void ListNodePushFront(ListNode* head, DataType x); //尾删 void ListNodePopBack(ListNode* head); //头删 void ListNodePopFront(ListNode* head); //查找数据 ListNode* ListNodeFind(ListNode* head, DataType x); //指定位置后插入 void ListNodeInsert(ListNode* pos, DataType x); //指定位置删除 void ListNodeErase(ListNode* pos); //销毁链表 void ListNodeDestroy(ListNode* head); 2. list.c #define _CRT_SECURE_NO_WARNINGS h#includelist.hListNode* BuyListNode(DataType x) {ListNode* newnode (ListNode*)malloc(sizeof(ListNode));if (newnode NULL){exit(-1);}newnode-data x;newnode-next newnode-prev newnode;return newnode; }void ListNodeInit(ListNode** pphead) {*pphead BuyListNode(0); }void ListNodePushBack(ListNode* phead, DataType x) {ListNode* tail phead-prev;assert(phead);ListNode* newnode BuyListNode(x);newnode-prev phead-prev;newnode-next phead;tail-next newnode;//之前的尾指向现在的尾phead-prev newnode;//头的上一个改为现在的尾 }void ListNodePrint(ListNode* phead) {assert(phead);ListNode* tmp phead-next;while (tmp! phead){printf(%d , tmp-data);tmp tmp-next;} }void ListNodePushFront(ListNode* head,DataType x) {assert(head);ListNode* first head-next;ListNode* newnode BuyListNode(x);newnode-next head-next;newnode-prev head;first-prev newnode;head-next newnode; }void ListNodePopBack(ListNode* head) {assert(head);ListNode* tailhead-prev;ListNode* newtail tail-prev;head-prev newtail;newtail-next head;free(tail);tail NULL; }void ListNodePopFront(ListNode* head) {assert(head);ListNode* firsthead-next;ListNode* newfirst first-next;head-next newfirst;newfirst-prev head;free(first);first NULL; }ListNode* ListNodeFind(ListNode* head,DataType x) {assert(head);ListNode* tmp head-next;while (tmp!head){if (tmp-data x)return tmp;tmp tmp-next;}return NULL; }void ListNodeInsert(ListNode* pos, DataType x) {assert(pos);ListNode* newnext pos-next;ListNode* newnode BuyListNode(x);newnode-prev pos;newnode-next newnext;pos-next newnode;newnext-prev newnode;}void ListNodeErase(ListNode* pos) {assert(pos);ListNode* posprev pos-prev, * posnext pos-next;posprev-next posnext;posnext-prev posprev;free(pos);pos NULL; }void ListNodeDestroy(ListNode* head) {assert(head);ListNode* cur head-next;while (cur ! head){ListNode* next cur-next;free(cur);cur next;} } 3. 测试 #define _CRT_SECURE_NO_WARNINGS h#includelist.h void test() {ListNode* headNULL;ListNodeInit(head);ListNodePushBack(head, 2);ListNodePushBack(head, 45);ListNodePushBack(head, 33);ListNodePushFront(head, 22);ListNodePushFront(head, 66);ListNode* findListNodeFind(head,33);ListNodeInsert(find, 666);ListNodePrint(head);printf(\n);//ListNodePopBack(head);ListNodeErase(find);ListNodePopFront(head);ListNodePrint(head);}int main() {test(); } 感谢大家观看希望可以帮到您 づ3づ╭❤
http://www.hkea.cn/news/14365520/

相关文章:

  • 怎么做报名网站画册设计说明
  • 南通手机建站模板ios wordpress fixed
  • 赣州市建设局建管科网站工作作风方面对照检查材料
  • 网站建设有没有资质电商网站开发图书
  • dz门户做视频网站从什么网站找做app的代码
  • 网站使用手册成都代理记账
  • 建网站找兴田德润开个游戏工作室要多少钱
  • 开个网站建设公司多少钱官方网站查询电工证
  • 建设门户网站的公司替换wordpress
  • 贸易公司寮步网站建设哪家好刚学完网站开发
  • 成都环境建设网站加快网站打开速度
  • 做网站泰安南昌商城建设
  • 如何评价一个企业网站做的好百度首页登录入口
  • 方太网站谁做的上海专业做网站
  • 《奖励自己的网站》中国设计师联盟网站
  • 可以做反链的网站湛江有哪些网站建设公司
  • 医疗行业网站怎么做做网站会用到什么语言
  • 济南做网站推广有哪些公司wordpress网站转app
  • 网站规划书包括哪些方面系统与网站的区别
  • 网站备案的好处有哪些深圳建筑设计招聘
  • 在学做网站还不知道买什么好潜江资讯网二手房出售
  • 网站设计扁平化关键词密度查询站长工具
  • 硅云wordpress多站点鞍山微信小程序开发公司
  • 云南城市建设职业学院成绩查询网站互联网行业数据分析
  • 广州注册个体户流程及费用网站优化具体做哪些事情
  • 网站开发接口文档模板网站怎么做能快速有排名
  • 汽车之家 网站建设网站在百度的图标显示不正常显示
  • 网站建设推广哪个好鹤壁集团网站建设
  • 网站优化团队常州建设局下属网站
  • 免费个人搭建网站公司名字大全洋气