当前位置:网站首页>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
边栏推荐
- 2022-08-04: Input: deduplicated array arr, the numbers in it only contain 0~9.limit, a number.Return: The maximum number that can be spelled out with arr if the requirement is smaller than limit.from
- mysql树状结构查询问题
- C语言日记 9 if的3种语句
- 采用redis缓存的linux主从同步服务器图片硬盘满了移到新目录要修改哪些指向
- leetcode 15
- Apache DolphinScheduler新一代分布式工作流任务调度平台实战-中
- The 22-07-31 weeks summary
- Semi-Decentralized Federated Learning for Cooperative D2D Local Model Aggregation
- mysql没法Execute 大拿们求解
- Solve connect: The requested address is not valid in its context
猜你喜欢
Tencent Cloud [Hiflow] New Era Automation Tool
Matlab画图3
[LeetCode Brush Questions] - Sum of Numbers topic (more topics to be added)
Regular expression to match a certain string in the middle
Matlab drawing 3
正则表达式,匹配中间的某一段字符串
DAY22: sqli-labs shooting range clearance wp (Less01~~Less20)
LeetCode uses the minimum cost to climb the stairs----dp problem
[C language] Detailed explanation of stacks and queues (define, destroy, and data operations)
Cloud Native (32) | Introduction to Platform Storage System in Kubernetes
随机推荐
继承关系下构造方法的访问特点
语法基础(变量、输入输出、表达式与顺序语句)
程序员的七夕浪漫时刻
J9 Digital Currency: What is the creator economy of web3?
甘特图来啦,项目管理神器,模板直接用
Common hardware delays
lua learning
The 22-07-31 weeks summary
1527. Patients suffering from a disease
RAID disk array
lua学习
Apache DolphinScheduler新一代分布式工作流任务调度平台实战-中
Unleashing the engine of technological innovation, Intel joins hands with ecological partners to promote the vigorous development of smart retail
Industry case | insurance companies of the world's top 500 construction standards can be used to drive the business analysis system
2022-08-04: Input: deduplicated array arr, the numbers in it only contain 0~9.limit, a number.Return: The maximum number that can be spelled out with arr if the requirement is smaller than limit.from
1873. 计算特殊奖金
leetcode 15
Quickly learn chess from zero to one
shell语句修改txt文件或者sh文件
后期学习计划