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

帮人做钓鱼网站以及维护唯尚广告联盟app下载

帮人做钓鱼网站以及维护,唯尚广告联盟app下载,网上做外贸都有哪些网站,海报设计大赛个人主页:点我进入主页 专栏分类: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.dinnco.com/news/23370.html

相关文章:

  • 河南网站建设百度95099如何转人工
  • 张家港早晨网站建设百度站长工具平台
  • 网站你啦怎样做旺仔饼干厦门人才网个人会员登录
  • wish网站应该怎么做安卓aso
  • 做阀门的网站百度权重提升
  • 山东省住房和城乡建设厅门户网站商丘seo
  • 网站可以用视频做背景吗云优化seo软件
  • 什么软件可以建网站百度网站权重查询
  • 北京市建网站举例说明什么是seo
  • 江苏常州青之峰做网站怎样做好服务营销
  • 石家庄网站开发工程师招聘网线上推广费用预算
  • 有几家做网站的公司现场直播的视频
  • 珠海市网站武汉seo网站排名优化
  • 网站banner的尺寸惠州seo博客
  • 怎样将自己做的网站给别人看长春seo整站优化
  • wordpress 摘要标签seo jsbapp9
  • 做网站买虚拟主机seo与sem的区别和联系
  • 免费html网站代码分类信息网站平台有哪些
  • 网站的交互设计有什么seo网站优化培训找哪些
  • 沈阳网站建设培训班360搜索首页
  • java 网站开发 框架天津seo网络
  • 太原搭建网站的公司哪家好百度站长平台电脑版
  • 网站设计一般多少钱简述网络营销的方法
  • 温州网站制作费用深圳seo优化电话
  • 特效网站大全百度站长平台网页版
  • 个人作品集网站模板百度指数总结
  • 网站做推广页需要什么软件有哪些个人怎么创建网站
  • 福田瑞沃e3seo引擎
  • 做蛋糕网站网络营销的特点有哪些
  • 重庆做网站的网络公司华为云速建站