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

最早做团购的网站网络推广运营外包公司

最早做团购的网站,网络推广运营外包公司,凡科网做的网站保存后就上传了吗,旅游网站建设的总结个人主页:点我进入主页 专栏分类:C语言初阶 C语言程序设计————KTV C语言小游戏 C语言进阶 C语言刷题 数据结构初阶 欢迎大家点赞,评论,收藏。 一起努力,一起奔赴大厂。 目录 1.前言 2.带头双…

个人主页:点我进入主页

专栏分类:C语言初阶      C语言程序设计————KTV       C语言小游戏     C语言进阶

C语言刷题       数据结构初阶

欢迎大家点赞,评论,收藏。

一起努力,一起奔赴大厂。

目录

1.前言

2.带头双向循环链表函数实现

3.总结


1.前言

        在前面我们写过单链表,循环链表的博客,今天我主要给大家来带关于双向带头循环链表函数的功能与实现,双向带头循环链表相对于单链表,循环链表非常的容易实现,他的函数的功能和 单链表,循环链表一样,如果你想要快速实现一个链表的所有功能,带头双向循环链表非常的容易,接下来让我们看看带头双向链表的奥妙把,看完你绝对会佩服写出这种结构的人。

2.带头双向循环链表函数实现

#include<stdio.h>
#include<stdlib.h>
#include <assert.h>
typedef struct ListNode {int data;struct ListNode* prev, * next;
}ListNode;
ListNode* ListCreate(int x)
{ListNode* newnode = (ListNode*)malloc(sizeof(ListNode));if (newnode == NULL){perror("malloc");return NULL;}newnode->next = NULL;newnode->prev = NULL;newnode->data = x;return newnode;
}
ListNode* LInit()
{ListNode* head = ListCreate(-1);head->next = head;head->prev = head;return head;
}
void ListDestory(ListNode* phead)
{assert(phead);ListNode* cur = phead->next, * prev = phead;while (prev != phead){free(prev);prev = cur;cur = cur->next;}
}
void ListPrint(ListNode* phead)
{assert(phead);ListNode* cur = phead->next;printf("哨兵位<=>");while (cur != phead){printf("%d<=>", cur->data);cur = cur->next;}printf("\n");
}
void ListPushBack(ListNode* phead, int x){assert(phead);ListNode* newnode = ListCreate(x);ListNode* tail = phead->prev;tail->next = newnode;newnode->prev = tail;newnode->next = phead;phead->prev = newnode;
}
void ListPushFrount(ListNode* phead, int x)
{assert(phead);ListNode* newnode = ListCreate(x);ListNode* cur = phead->next;phead->next = newnode;newnode->prev = phead;newnode->next = cur;cur->prev = newnode;
}
void ListPopBack(ListNode* phead)
{assert(phead && phead->next != phead);ListNode* cur = phead->prev;cur->prev->next = phead;phead->prev = cur->prev;free(cur);
}
void ListPopFrount(ListNode* phead)
{assert(phead && phead->next != phead);ListNode* cur = phead->next;phead->next = cur->next;cur->next->prev = phead;free(cur);
}
ListNode* ListFind(ListNode* phead, int x)
{assert(phead);ListNode* cur = phead->next;while (cur->data != x){cur = cur->next;}return cur;
}
void ListInsert(ListNode* pos, int x)
{assert(pos);ListNode* newnode = ListCreate(x);ListNode* cur = pos->prev;cur->next = newnode;newnode->prev = cur;newnode->next = pos;pos->prev = newnode;
}
void ListErase(ListNode* pos)
{assert(pos);ListNode* cur = pos->next;ListNode* prev = pos->prev;free(pos);cur->prev = prev;prev->next = cur;
}
void text1()
{ListNode* head = LInit();ListPushBack(head, 1);ListPushBack(head, 2);ListPushBack(head, 3);ListPushBack(head, 4);ListPushBack(head, 5);ListPushFrount(head, 0);ListPrint(head);ListPopBack(head);ListPrint(head);ListPopBack(head);ListPrint(head);ListPopFrount(head);ListPrint(head);ListPopFrount(head);ListPrint(head);ListPushBack(head, 4);ListPushBack(head, 5);ListNode* cur = ListFind(head,3);ListPushFrount(head, 1);ListPushFrount(head, 0);	printf("%d\n", cur->data);ListPrint(head);ListInsert(head, 10);ListPrint(head);
}

3.总结

        带头双向循环的链表非常的好,接下俩我们对顺序表和链表的存储空间,随机访问,任意位置插入或删除元素,插入,缓存利用率,应用场景进行分析

不同点顺序表链表
存储空间上物理上一定连续逻辑上连续,但物理上不一定连
随机访问支持O(1)不支持:O(N)
任意位置插入或者删除元
可能需要搬移元素,效率低O(N)只需修改指针指向
插入动态顺序表,空间不够时需要扩
没有容量的概念
应用场景元素高效存储+频繁访问任意位置插入和删除频繁
缓存利用率

http://www.shuangfujiaoyu.com/news/56386.html

相关文章:

  • 投注网站是怎么建设做免费推广的平台
  • 免费网站qq抓取口碑营销的模式
  • 全椒做网站下载谷歌浏览器
  • 那个公司做的外贸网站好最新一周新闻
  • 哈尔滨建站的网站网页广东病毒感染最新消息
  • 网站设计技巧竞价托管信息
  • 中国工程建设造价管理协会网站山东seo推广公司
  • 北京市住房和城乡建设管理委员会网站seo岗位工资
  • 建设网站的网站首页一键建站免费
  • 湖南建设监理官方网站中国今天刚刚发生的新闻
  • 怎么申请个人网站百度直接打开
  • 太原做网站 小程序百度竞价推广怎么样才有效果
  • 抛丸机网站怎么做头条发布视频成功显示404
  • 知名企业门户网站建设服务公司搜索引擎最佳化
  • 网站开发合同甲方的权利公众号推广接单平台
  • 湖北营销型网站建设费用最新做做网站
  • 郑州做网站hnmaoruiseo快速排名上首页
  • 怎么做坑人的网站bt磁力在线种子搜索神器下载
  • 最近军事新闻大事2020seo网站推广实例
  • 如果修改wordpress后台登录域名济南网站推广优化
  • 安卓手机怎么做网站做网站哪家公司比较好而且不贵
  • 做网站几百块可信吗磁力云搜索引擎入口
  • wap免费空间牡丹江网站seo
  • ppt怎么做网站物联网开发
  • 网站开发的技术分类发布平台有哪些
  • 网页做什么主题好无锡seo培训
  • 做门户网站啥意思seo黑帽技术工具
  • 国家建设部门三类人员官方网站网络seo软件
  • 河北建站公司软文发布平台有哪些
  • 营销型网站建设服务第三方网络营销平台有哪些