数据结构c语言版 循环链表表示和实现(Data structure, C language, circular list representation and Implementation).docVIP
- 8
- 0
- 约 20页
- 2017-10-07 发布于河南
- 举报
数据结构c语言版 循环链表表示和实现(Data structure, C language, circular list representation and Implementation)
数据结构c语言版 循环链表表示和实现(Data structure, C language, circular list representation and Implementation)
Data structure, C language, circular list representation and implementation of.Txt
*
Data structure, C language, circular list representation and Implementation
P35
Compile environment: Dev-C++ 4.9.9.2
Date: February 10, 2011
* /
#include stdio.h
#include malloc.h
#include stdlib.h
Typedef int ElemType;
/ / single stranded linear table storage structure
Typedef struct LNode
{
ElemType data;
Struct LNode *next;
}LNode, *LinkList;
To distinguish what is / / the first node ((*L) -next), the tail node (*L), and the first node
/ / point (*L) -next-next, the establishment of circular linked list tail pointer (end to end, the head node
/ / and the tail node is the same, they have no data domain.
/ / constructing an empty circular list L
Int InitList_CL (LinkList *L)
{
Have / head node and the L, pointing to the head
*L = (LinkList) malloc (sizeof (struct, LNode));
If (... *L)
Exit (0);
/ / pointer field toward the head node, so as to form a circular, empty table loop, *L table tail
(*L) -next = *L;
Return 1;
}
The destruction of the circular list / / L
Int DestroyList_CL (LinkList *L)
{
LinkList q,
P = -next (*L); / / P refers to the head node
While (P! = *L) / / not to the table for table tail tail, *L
{
Q = p-next;
Free (P);
P = q;
}
Free (*L);
*L = NULL;
Return 1;
}
/ / reset L to the empty table
Int ClearList_CL (LinkList *L)
{
LinkList, P, q;
*L= (*L -next); / / L points to the first node
P= (*L -next); / / P refers to the first node
While (P! =*L) / / not to list.
{
Q=p-next;
Free (P);
P=q;
}
-next=*L (*L); / / the first node pointer domain refers to itself
Return 1;
}
/ / if L is empty table, it returns 1, otherwise it returns 0
Int ListEmpty_CL (LinkList L)
{
If (L-next==L) / / empty
Return 1;
Else
Return 0;
}
/ / returns the number of elements in the L data
Int ListLength_CL (LinkList L)
{
Int i=0;
LinkList p=L-next; / / P refers to the head node
While (P! =L) / / not t
您可能关注的文档
- 我的获奖作文(My award-winning composition).doc
- 我的高中简史,上蔡二高之我不是来打酱油的(My brief history of high school, Shangcai two, I am not here to play soy sauce).doc
- 我的治喉法则(My rule of the throat).doc
- 我国粮食分布(Grain distribution in China).doc
- 戒烟趣法(Smoking cessation fun).doc
- 战国城池(Warring States city).doc
- 我的国考经历(完整版)(My national exam experience (full version)).doc
- 战国时代,官职(Office in the Warring States Period).doc
- 战国烽烟起,摆酒论诸侯--地域品牌发展浅析(In the Warring States period, feast on regional brand development of princes).doc
- 战争之人苏联攻略(Man of war, Soviet Union).doc
最近下载
- SY_T 5106-2019 石油天然气钻采设备 封隔器规范.docx VIP
- 世界著名谈判案例.docx VIP
- T_CPI 11037-2024 石油天然气钻采设备水力振荡器技术与应用规范.docx VIP
- 雪铁龙维修 手册 图DS_5LS_Owner_Book_ZH.pdf VIP
- 2025至2030药用真菌行业项目调研及市场前景预测评估报告.docx
- T_SCMES 24—2024(石油天然气钻采设备智能钻机).pdf VIP
- 财务共享模式下企业内部控制研究——以延长石油为例.docx VIP
- 财务共享延长石油集成方案.pdf VIP
- 2025《延安延长石油集团财务共享中心实施效果分析的案例报告》8200字.doc VIP
- 2025人教版音乐一年级下册全册教学设计教案.pdf
原创力文档

文档评论(0)