当前位置:网站首页>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
边栏推荐
- 【 2 】 OpenCV image processing: basic knowledge of OpenCV
- 解决端口占用问题 Port xxxx was already in use
- 627. Change of gender
- Access Characteristics of Constructor under Inheritance Relationship
- HDU 1114:Piggy-Bank ← 完全背包问题
- Data storage practice based on left-order traversal
- [深入研究4G/5G/6G专题-51]: URLLC-16-《3GPP URLLC相关协议、规范、技术原理深度解读》-11-高可靠性技术-2-链路自适应增强(根据无线链路状态动态选择高可靠性MCS)
- C学生管理系统 头添加学生节点
- 语法基础(变量、输入输出、表达式与顺序语句)
- Ant Sword Advanced Module Development
猜你喜欢
Matlab画图3
What should I do if the self-incrementing id of online MySQL is exhausted?
【OpenCV 图像处理2】:OpenCV 基础知识
J9 Digital Currency: What is the creator economy of web3?
How Jin Cang database correctness verification platform installation file
[LeetCode Brush Questions] - Sum of Numbers topic (more topics to be added)
DAY22: sqli-labs shooting range clearance wp (Less01~~Less20)
【解密】OpenSea免费创造的NFT都没上链竟能出现在我的钱包里?
云原生(三十二) | Kubernetes篇之平台存储系统介绍
2022-08-04:输入:去重数组arr,里面的数只包含0~9。limit,一个数字。 返回:要求比limit小的情况下,能够用arr拼出来的最大数字。 来自字节。
随机推荐
金仓数据库如何验证安装文件平台正确性
Note that Weifang generally needs to pay attention to issuing invoices
Lexicon - the maximum depth of a binary tree
ARM Mailbox
Introduction to SDC
程序员的七夕浪漫时刻
Multithreading (2)
C学生管理系统 据学号查找学生节点
C学生管理系统 头添加学生节点
mysql树状结构查询问题
百日刷题计划 ———— DAY2
语法基础(变量、输入输出、表达式与顺序语句)
【LeetCode刷题】-数之和专题(待补充更多题目)
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
[ROS] (10) ROS Communication - Service Communication
Pisanix v0.2.0 released | Added support for dynamic read-write separation
nodeJs--encapsulate routing
RAID磁盘阵列
【解密】OpenSea免费创造的NFT都没上链竟能出现在我的钱包里?
LeetCode使用最小花费爬楼梯----dp问题