当前位置:网站首页>Double linked list related operations
Double linked list related operations
2022-07-01 12:22:00 【Between the steps】
Double linked list related operations
Double linked list related operations
Initialization of double linked list
#include<stdio.h>
typedef struct DNode{
int data;
struct DNode *prior,*next;
}DNode,*DLinklist;
// Initialize double linked list
bool InitDLinkList(DLinklist &L){
L=(DNode*)malloc(sizeof(DNode)); // Assign a head node
if(L==NULL){
return false;
}
L->prior=NULL; // The first node prior For ever NULL
L->next=NULL;
return true;
}
// The list is empty
bool Empty(DLinklist L){
if(L->next==NULL)
return true;
else
return false;
}
void main(){
DLinklist L;
InitDLinkList(L);
}
Insertion of double linked list
bool InsertNextDNode(DNode *p,DNode *s){
if(p==NULL||s==NULL){
return false;
}
s->next=p->next; // The node *s Insert to node *p after
if(p->next!=NULL)
p->next->prior=s;
s->prior=p;
p->next=s;
return true;
}


Deletion of double linked list nodes
// Delete p The successor node of a node
bool InsertNextDNode(DNode *p){
if(p==NULL){
return false;
}
DNode *q=p->next; // find p The successor node of
if(q==NULL){
return false; //p No successor nodes
}
p->next=q->next;
if(q->next!=NULL) //q Node is not the last node
q->next->prior=p
free(q); // Release node space
return true;
}


Destroy a double linked list
Traversal of double linked list
边栏推荐
- Ipv6-6to4 experiment
- The Missing Semester
- Wechat applet reports an error: [rendering layer network layer error] pages/main/main Local resource pictures in wxss cannot be obtained through wxss. You can use network pictures, Base64, or < image/
- uniapp 使用 uni-upgrade-center
- [datawhale202206] pytorch recommendation system: recall model DSSM & youtubednn
- 消息队列之监控退款任务批处理过程
- Good luck brought by years of persistence
- JS related interview questions and answers (1)
- Typora adds watermarks to automatically uploaded pictures
- The Missing Semester
猜你喜欢
![[speech signal processing] 3 speech signal visualization -- prosody](/img/06/5f57f9dfe3a0f2f70022706f7d4d17.jpg)
[speech signal processing] 3 speech signal visualization -- prosody

How to use opcache, an optimization acceleration component of PHP

【语音信号处理】3语音信号可视化——prosody

Machine learning - Data Science Library - day two

Joint Time-Frequency and Time Domain Learning for Speech Enhancement
![[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 7](/img/41/e3ecbd49e4bfeab6c6e7d8733fe33a.jpg)
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 7

【20211129】Jupyter Notebook远程服务器配置

技术分享 | MySQL:从库复制半个事务会怎么样?

Arm GIC (V) how arm TrustZone supports security interrupt analysis notes.
![[datawhale202206] pytorch recommendation system: multi task learning esmm & MMOE](/img/8f/64fea641730795a2b5252cc2c8cdd2.png)
[datawhale202206] pytorch recommendation system: multi task learning esmm & MMOE
随机推荐
Efforts at the turn of the decade
本科毕业四年:工作,辞职,结婚,买房
[datawhale202206] pytorch recommendation system: multi task learning esmm & MMOE
Talk about biological live broadcast - genovis Zhang Hongyan antibody specific enzyme digestion technology helps to characterize the structure of antibody drugs
双链表有关操作
MQ prevent message loss and repeated consumption
Arm GIC (V) how arm TrustZone supports security interrupt analysis notes.
The Missing Semester
LeetCode 454. Add four numbers II
【20211129】Jupyter Notebook远程服务器配置
Sum of factor numbers of interval product -- prefix sum idea + fixed one shift two
第十四章 信号(四)- 多进程任务示例
C summary of knowledge points 1
Sort out relevant contents of ansible
C summary of knowledge points 3
Onenet Internet of things platform - mqtt product devices send messages to message queues MQ
91. (cesium chapter) cesium rocket launch simulation
Uniapp uses uni upgrade Center
91.(cesium篇)cesium火箭發射模擬
[20211129] configuration du serveur distant du carnet de notes jupyter

