当前位置:网站首页>Simple description of linked list and simple implementation of code
Simple description of linked list and simple implementation of code
2022-08-05 02:46:00 【Xiao Ben】
3.链表
3.1 链表的概念及结构
概念:链表是一种物理存储结构上非连续、非顺序的存储结构,数据元素的逻辑顺序是通过链表中的指针链接次序实现的 ,Like the train below.
in real data structures
注意:
- Nodes in a linked list are logically consecutive,Physically not necessarily continuous
- In reality, nodes are generally applied for from the heap
- The space requested from the heap is allocated according to a certain strategy,physically possible continuous,也可能不连续
3.2 链表的分类
实际中链表的结构非常多样,以下情况组合起来就有8种链表结构:
单向或者双向
带头或者不带头
循环或者非循环
虽然有这么多的链表的结构,但是我们实际中最常用还是两种结构:
无头单向非循环链表:结构简单,一般不会单独用来存数据.实际中更多是作为其他数据结构的子结构,如哈希桶、图的邻接表等等.
带头双向循环链表:结构最复杂,一般用在单独存储数据.实际中使用的链表数据结构,都是带头双向循环链表.另外这个结构虽然结构复杂,但是使用代码实现以后会发现结构会带来很多优势,实现反而简单了,You will know when the next code is implemented.
3.3 链表的实现
typedef int SLTDateType;
typedef struct SLT
{
SLTDateType data;
struct SLT* next;
}SListNode;
// 动态申请一个节点
SListNode* BuySListNode(SLTDateType x);
// 单链表打印
void SListPrint(SListNode* plist);
// 单链表尾插
void SListPushBack(SListNode** pplist, SLTDateType x);
// 单链表的头插
void SListPushFront(SListNode** pplist, SLTDateType x);
// 单链表的尾删
void SListPopBack(SListNode** pplist);
// 单链表头删
void SListPopFront(SListNode** pplist);
// 单链表查找
SListNode* SListFind(SListNode* plist, SLTDateType x);
// 单链表在pos位置之后插入x
// 分析思考为什么不在pos位置之前插入?
void SListInsertAfter(SListNode* pos, SLTDateType x);
// 单链表删除pos位置之后的值
// 分析思考为什么不删除pos位置?
void SListEraseAfter(SListNode* pos);
// 单链表的销毁
void SListDestroy(SListNode* plist);
// 单链表删除pos位置的值
void SListErase(SListNode** plist, SListNode* pos);
The specific content of the function is uploaded togitee
边栏推荐
- QT:神奇QVarient
- [ROS](10)ROS通信 —— 服务(Service)通信
- Data storage practice based on left-order traversal
- nodeJs--封装路由
- torch.roll()
- 【OpenCV 图像处理2】:OpenCV 基础知识
- Unleashing the engine of technological innovation, Intel joins hands with ecological partners to promote the vigorous development of smart retail
- 1667. Fix names in tables
- Programmer's Tanabata Romantic Moment
- 金仓数据库如何验证安装文件平台正确性
猜你喜欢
Compressed storage of special matrices
mysql没法Execute 大拿们求解
Ant Sword Advanced Module Development
QT MV\MVC结构
使用二维码传输文件的小工具 - QFileTrans 1.2.0.1
matlab绘制用颜色表示模值大小的箭头图
The design idea of DMicro, the Go microservice development framework
RAID磁盘阵列
Access Characteristics of Constructor under Inheritance Relationship
链表的简单描述及代码的简单实现
随机推荐
【LeetCode刷题】-数之和专题(待补充更多题目)
The Tanabata copywriting you want has been sorted out for you!
C student management system Find student nodes based on student ID
RAID磁盘阵列
Error: Not a signal or slot declaration
Access Characteristics of Constructor under Inheritance Relationship
627. Change of gender
leetcode - symmetric binary tree
1667. 修复表中的名字
1667. Fix names in tables
甘特图来啦,项目管理神器,模板直接用
你要的七夕文案,已为您整理好!
1527. Patients suffering from a disease
行业案例|世界 500 强险企如何建设指标驱动的经营分析系统
协作D2D局部模型聚合的半分散联合学习
leetcode - a subtree of another tree
注意潍坊开具发票一般需要注意
undo问题
[机缘参悟-60]:《兵者,诡道也》-2-孙子兵法解读
【C语言】详解栈和队列(定义、销毁、数据的操作)