数据结构之循环链表(C语言)

C# 单链表 | 双链表 | 循环链表的原理和代码实现 C#用代码实现一个单向链表,纯手搓。 阅读详情
循环链表概念:

       循环链表是一种特殊的链表结构。它与普通链表不同的地方在于,最后一个节点指向第一个节点,形成了一个环。这也就意味着,在循环链表中,每个节点都有前驱节点和后继节点。循环链表既可以向前遍历,也可以向后遍历。循环链表的应用场景主要是在需要循环处理数据的场合,例如游戏中的玩家列表、环形缓存等。

循环单链表的操作

基本代码:

struct Node {
	int data;
	struct Node* next;
};

struct Node* head = NULL;//头指针

int count = 0; //统计节点数量

struct Node* new(int x) //新节点的建立
{
	struct Node* temp = (struct Node*)malloc(sizeof(struct Node));
    temp->data = x;
	temp->next = NULL;
	return temp;
}


1、循环单链表的建立

头插法

void headList(int x)
{
	struct Node* temp = new(x);
	struct Node* header = head; //用header来代替头指针来遍历
	if (head == NULL) //链表为空
	{
		head = temp;
		temp->next = head;
		count++;
		return;
	}
	temp->next = head; //新节点指向head
	while (header->next != temp->next) //header移动到最后的节点
		header = header->next;
	header->next = temp; //header指向开头
	head = temp; //头指针更新
	count++;
}

尾插法

void lastList(int x)
{
	struct Node* temp = new(x);
	struct Node* header = head;
	if (head == NULL)
	{
		head = temp;
		temp->next = head;
		count++;
		return;
	}
	while (header->next != head) //header移动到尾节点
		header = header->next;
	temp->next = header->next; //新节点指向头指针
	header->next = temp; //header指向新节点
	count++;
} 

2、链表的按位插入

插入时应注意插入位置为开头或结尾,应进行特殊处理。

void Insert(int x, int data)
{
	struct Node* temp = new(data);
	struct Node* header = head;
	if (x == 1) //插入位置为1
	{
		temp->next = head;
		while (header->next != temp->next) //header移动到最后节点
			header = header->next;
		header->next = temp; //header指向新节点
		head = temp; //head更新
		count++;
		return;
	}
	if (x == count) //插入位置为count
	{
		while(header->next != head) //移动到最后节点
			header = header->next;
		temp->next = header->next; //新节点指向开头
		header->next = temp; //header指向新节点
		count++; 
		return; 
	}
	if (x<1 || x>count) //判断插入位置是否非法
	{
		printf("error!");
		return;
	}
	for (int i = 1; i < x-1; i++) //header移动到插入位置前节点
		header = header->next;
	temp->next = header->next; //新节点指向header指向的节点
	header->next = temp; //header指向新节点
	count++;
}

3、按位删除

注意删除节点位置为1时,应特殊处理;

void delete(int x)
{
	struct Node* header = head;
	if (x<1 || x>count) //判断删除位置是否合法
	{
		printf("error!\n");
		return;
	}
	if (head == NULL) //链表为空
	{
		printf("empty!\n");
		return;
	}
	if (x == 1) //删除节点位置为开头
	{
		while (header->next != head) //header移动到最后节点
			header = header->next;
		struct Node* A = head; //保存head节点
		head = head->next; //head移动
		printf("delete a number is %d\n", A->data); //打印
		header->next = head; //将header指向新的head
		free(A); //释放内存
		count--; //数量-1
		return;
	}
	for (int i = 1; i < x - 1; i++) //header移动到删除位置前节点
		header = header->next;
	struct Node* A = header->next; //保存删除节点地址
	header->next = A->next; // header指向删除节点的后节点
	printf("delete a number is %d\n", A->data);
	free(A);
	count--;
}

完整代码:
 

struct Node {
	int data;
	struct Node* next;
};

struct Node* head = NULL;//头指针

int count = 0; //统计节点数量

struct Node* new(int x) //新节点的建立
{
	struct Node* temp = (struct Node*)malloc(sizeof(struct Node));
    temp->data = x;
	temp->next = NULL;
	return temp;
}
//头插法
void headList(int x)
{
	struct Node* temp = new(x);
	struct Node* header = head; //用header来代替头指针来遍历
	if (head == NULL)
	{
		head = temp;
		temp->next = head;
		count++;
		return;
	}
	temp->next = head; //新节点指向head
	while (header->next != temp->next) //header移动到最后的节点
		header = header->next;
	header->next = temp; //header指向开头
	head = temp; //头指针更新
	count++;
}
//尾插法
void lastList(int x)
{
	struct Node* temp = new(x);
	struct Node* header = head;
	if (head == NULL)
	{
		head = temp;
		temp->next = head;
		count++;
		return;
	}
	while (header->next != head) //header移动到尾节点
		header = header->next;
	temp->next = header->next; //新节点指向头指针
	header->next = temp; //header指向新节点
	count++;
} 

//按位插入
void Insert(int x, int data)
{
	struct Node* temp = new(data);
	struct Node* header = head;
	if (x == 1) //插入位置为1
	{
		temp->next = head;
		while (header->next != temp->next) //header移动到最后节点
			header = header->next;
		header->next = temp; //header指向新节点
		head = temp; //head更新
		count++;
		return;
	}
	if (x == count) //插入位置为count
	{
		while(header->next != head) //移动到最后节点
			header = header->next;
		temp->next = header->next; //新节点指向开头
		header->next = temp; //header指向新节点
		count++; 
		return; 
	}
	if (x<1 || x>count) //判断插入位置是否非法
	{
		printf("error!");
		return;
	}
	for (int i = 1; i < x-1; i++) //header移动到插入位置前节点
		header = header->next;
	temp->next = header->next; //新节点指向header指向的节点
	header->next = temp; //header指向新节点
	count++;
}
//删除
void delete(int x)
{
	struct Node* header = head;
	if (x<1 || x>count) //判断删除位置是否合法
	{
		printf("error!\n");
		return;
	}
	if (head == NULL) //链表为空
	{
		printf("empty!\n");
		return;
	}
	if (x == 1) //删除节点位置为开头
	{
		while (header->next != head) //header移动到最后节点
			header = header->next;
		struct Node* A = head; //保存head节点
		head = head->next; //head移动
		printf("delete a number is %d\n", A->data); //打印
		header->next = head; //将header指向新的head
		free(A); //释放内存
		count--; //数量-1
		return;
	}
	for (int i = 1; i < x - 1; i++) //header移动到删除位置前节点
		header = header->next;
	struct Node* A = header->next; //保存删除节点地址
	header->next = A->next; // header指向删除节点的后节点
	printf("delete a number is %d\n", A->data);
	free(A);
	count--;
}


void Print()
{
	struct Node* header = head;
	for (int i = 0; i < 5; i++)
	{
		printf("%d ", header->data);
		header = header->next;
	}
	printf("\n");
}

int main()
{
	lastList(3);
	lastList(5);
	lastList(2);
	lastList(4);
	Insert(1,8);
	Print();
	delete(1);
	Print();
	return 0;
}

循环双链表的操作

基本代码:

struct Node {
	int data;
	struct Node* left;
	struct Node* right;
};

struct Node* head = NULL;

int count = 0;

struct Node* new(int x)
{
	struct Node* temp = (struct Node*)malloc(sizeof(struct Node));
    temp->data = x;
	temp->left = NULL;
	temp->right = NULL;
	return temp;
}

1、循环双链表的建立

头插法

void headList(int x)
{
	struct Node* temp = new(x);
	struct Node* header = head;
	if (head == NULL) //链表为空
	{
		head = temp;
		temp->right = head; //指向新节点
		temp->left = head; //指向新节点
		count++;
		return;
	}
	while (header->right != head) //header指向最后节点
		header = header->right;
	temp->right = head; //新节点右指针指向head
	head->left = temp; //head指向节点的左节点指向新节点
	temp->left = header; //新节点左指针指向header
	header->right = temp; //header右指针指向新节点
	head = temp; //头指针更新
	count++;
}

尾插法

void lastList(int x)
{
	struct Node* header = head;
	struct Node* temp = new(x);
	if (head == NULL)
	{
		head = temp;
		temp->right = head;
		temp->left = temp;
		count++;
		return;
	}
	while (header->right != head) //header指向尾节点
		header = header->right;
	temp->right = header->right; //新节点右指针指向head
	head->left = temp; //head的左指针指向新节点
	header->right = temp; //header的右指针指向新节点
	temp->left = header; //新节点的左指针指向header
	count++;
}

2、按位插入

应对插入位置为1的情况进行特殊处理;


void Insert(int x, int data)
{
	struct Node* header = head;
	struct Node* temp = new(data);
	if (head == NULL) 
	{
		printf("error!/n");
		return;
	}
	if (x<1 || x>count)
	{
		printf("error!\n");
		return;
	}
	if (x == 1) //插入位置为开头
	{
		while (header->right != head) //移动到尾节点
			header = header->right;
		temp->right = head; //新节点的右指针指向头节点
		header->right = temp; //header的右指针指向新节点
		temp->left = header; //新节点的左指针指向尾节点
		head->left = temp; //头节点的左指针指向新节点
		head = temp; //头指针的更新
		count++;
		return;
	}
	for (int i = 1; i <= x - 1; i++)
		header = header->right;
	temp->right = header->right;
	header->right->left = temp;
	header->right = temp;
	temp->left = header;
	count++;
}

3、按位删除

对删除位置为开头和删除位置为结尾的情况进行特殊处理;

void delete(int x)
{
	struct Node* header = head;
	if (x<1 || x>count)
	{
		printf("error!\n");
		return;
	}
	if (x == 1) 
	{
		struct Node* A = head;
		head = head->right;
		head->left = A->left;
		A->left->right = head;
		free(A);
		count--;
		return;
	}
	if (x == count)
	{
		struct Node* A = head->left;
		header = A->left;
		header->right = head;
		head->left = header;
		free(A);
		count--;
		return;
	}
	for (int i = 1; i < x - 1; i++)
		header = header->right;
	struct Node* A = header->right;
	header->right = A->right;
	A->right->left = header;
	free(A);
	count--;
}

4、遍历(打印)

void Print()
{
	int falg = 0;
	struct Node* header = head;
	while (header != head || falg == 0)
	{
		printf("%d ", header->data);
		if (header->right == head)
		{
			falg = 1;
			break;
		}
		header = header->right;
	}
	printf("\n");
	struct Node* last = header;
	while (header != last|| falg == 1)
	{
		printf("%d ", header->data);
		if (header->left == last)
		{
			falg = 0;
			break;
		}
		header = header->left;
	}
	printf("\n");
}

完整代码:

struct Node {
	int data;
	struct Node* left;
	struct Node* right;
};

struct Node* head = NULL;

int count = 0;

struct Node* new(int x)
{
	struct Node* temp = (struct Node*)malloc(sizeof(struct Node));
    temp->data = x;
	temp->left = NULL;
	temp->right = NULL;
	return temp;
}

//头插法
void headList(int x)
{
	struct Node* temp = new(x);
	struct Node* header = head;
	if (head == NULL) //链表为空
	{
		head = temp;
		temp->right = head; //指向新节点
		temp->left = head; //指向新节点
		count++;
		return;
	}
	while (header->right != head) //header指向最后节点
		header = header->right;
	temp->right = head; //新节点右指针指向head
	head->left = temp; //head指向节点的左节点指向新节点
	temp->left = header; //新节点左指针指向header
	header->right = temp; //header右指针指向新节点
	head = temp; //头指针更新
	count++;
}

//尾插法
void lastList(int x)
{
	struct Node* header = head;
	struct Node* temp = new(x);
	if (head == NULL)
	{
		head = temp;
		temp->right = head;
		temp->left = temp;
		count++;
		return;
	}
	while (header->right != head) //header指向尾节点
		header = header->right;
	temp->right = header->right; //新节点右指针指向head
	head->left = temp; //head的左指针指向新节点
	header->right = temp; //header的右指针指向新节点
	temp->left = header; //新节点的左指针指向header
	count++;
}

//按位插入
void Insert(int x, int data)
{
	struct Node* header = head;
	struct Node* temp = new(data);
	if (head == NULL) 
	{
		printf("error!/n");
		return;
	}
	if (x<1 || x>count)
	{
		printf("error!\n");
		return;
	}
	if (x == 1) //插入位置为开头
	{
		while (header->right != head) //移动到尾节点
			header = header->right;
		temp->right = head; //新节点的右指针指向头节点
		header->right = temp; //header的右指针指向新节点
		temp->left = header; //新节点的左指针指向尾节点
		head->left = temp; //头节点的左指针指向新节点
		head = temp; //头指针的更新
		count++;
		return;
	}
	for (int i = 1; i <= x - 1; i++)
		header = header->right;
	temp->right = header->right;
	header->right->left = temp;
	header->right = temp;
	temp->left = header;
	count++;
}
//删除
void delete(int x)
{
	struct Node* header = head;
	if (x<1 || x>count)
	{
		printf("error!\n");
		return;
	}
	if (x == 1) 
	{
		struct Node* A = head;
		head = head->right;
		head->left = A->left;
		A->left->right = head;
		free(A);
		count--;
		return;
	}
	if (x == count)
	{
		struct Node* A = head->left;
		header = A->left;
		header->right = head;
		head->left = header;
		free(A);
		count--;
		return;
	}
	for (int i = 1; i < x - 1; i++)
		header = header->right;
	struct Node* A = header->right;
	header->right = A->right;
	A->right->left = header;
	free(A);
	count--;
}
//打印
void Print()
{
	int falg = 0;
	struct Node* header = head;
	while (header != head || falg == 0)
	{
		printf("%d ", header->data);
		if (header->right == head)
		{
			falg = 1;
			break;
		}
		header = header->right;
	}
	printf("\n");
	struct Node* last = header;
	while (header != last|| falg == 1)
	{
		printf("%d ", header->data);
		if (header->left == last)
		{
			falg = 0;
			break;
		}
		header = header->left;
	}
	printf("\n");
}
int main()
{
	lastList(3);
	lastList(5);
	lastList(8);
	lastList(9);
	lastList(4);
	Print();
	Insert(1, 88);
	Insert(6, 99);
	Print();
	delete(5);
	Print();
	return 0;
}

链表章节完结!

循环链表-数据结构(C语言) 在将循环链表之前我们第一步要掌握的是链表,循环链表是链表的一种。循环链表是另一种形式的链式存储结构。它的特点是表中最后一个结点的指针域指向头结点,整个链表形成一个环。 阅读详情

相关推荐

详解循环链表(数据结构C语言)

本文简单介绍了循环链表的基本概念,特点以及基础运算,并附上了代码以及结果,希望以后复习时可以加深自己的印象;在运行过程中,总有一些卡壳的部分,在朋友的指导下,修改代码并顺利完成结果。

m0_59068067的博客 1606

C语言数据结构——循环链表

在双向循环链表中,每个结点包括三个域,分别是 data 域、next 域和 prev 域,其中data域为数据域,next 域为指向后继结点的指针域,prev域为指向前驱结点的指针域。下图为链表的结点结构。

m0_73676323的博客 1892

基于STM32F407的立创球形六足双形态机器人:从Morphex复刻到毕业设计的完整开发指南

本文详细介绍了基于STM32F407主控芯片,从零开始复刻Morphex球形六足双形态机器人的完整开发过程。内容涵盖硬件选型(如总线舵机)、机械结构设计(阿基米德螺旋底盘)、软件控制(逆运动学与步态算法)以及多控制方式集成,为嵌入式系统与机器人开发的毕业设计或爱好者提供了全面的实战指南。

weixin_35414260的博客 318

循环链表详解(C语言)

本文主要讲述循环链表的基本定义特点以及一些常见操作并使用C语言代码对其进行实现。如何使用C语言代码去创建循环链表、插入头为节点、删除元素、输出链表长句、打印链表等基本运算。本文仅仅主要介绍了循环链表的概念、特点、运算以及循环链表的优缺点比较。特别注意当我们在实现循环连表时, 循环单链表没有明显的结束条件,很容易陷入死循环。此时,我们可以设置一个标记点作为循环的标记,当我们知道表长,我们也可以设置一个计数器来结束循环。

m0_55698213的博客 3414

Web渗透(一)CRLF注入简介

CRLF注入简介1、基础知识2、原理分析3、漏洞挖掘4、防御手段5、CRLF Payload: 1、基础知识 HTTP报文结构 从上图可以看到:HTTP报文由三部分组成:状态行、首部、主体。 可以看到状态行和首部中的每行都是以回车符(\r,%0d,CR)和换行符(\n,%0a,LF)结束。 十六进制编码分别为0x0d和0x0a,URL编码为%0D和%0A 这是因为HTTP规范中行应该使用CRLF结束。另外,首部和主体由两个CRLF分隔。 2、原理分析 CRLF是 “ 回车+换行 ”(\r\n)的简称。

weixin_39157582的博客 6795

AXI Memory Mapped To PCI Express IP 核设计实例

本文详细描述了AXI Memory Mapped To PCI Express(2.9) IP核的应用实例

u011565038的博客 2790

c语言实现数据结构双向循环链表

由于双向循环链表的结构使尾插不需要在遍历链表去找尾节点,因为哨兵位头节点的prev指针正指向了尾节点,对该节点保存后插入即可,与头插逻辑类似,原本的尾节点指向新的尾节点,新的尾节点指向原本的尾节点,新的尾节点指向哨兵位头节点,哨兵位指向新的尾节点使其保持循环结构。哨兵位头节点创建有助于我们在增删查改时无需改变实际头节点的指针,实际头节点永远是哨兵位头节点的next指针指向的节点,因为哨兵位头节点不存储实际数据,也就是哨兵位头节点的下一个节点。以下是本次实现的函数声明以及双向链表节点结构体的定义。

2502_93749749的博客 1099

【Blockly开发教程】01 初识Blockly

Blockly 是由 Google 开发的开源代码库,它可以为网页程序和移动端应用程序添加可视化代码编辑器。

Bright的博客 4508

C语言数据结构学习:双循环链表

C语言数据结构学习:双循环链表

L_Z_J_I的博客 362

Xilinx SDK工程编译、链接、调试注意事项

1、添加工程 启动SDK时选取workspace,如下图所示: 对应的workpace文件夹中会生成如下几个文件: 如果当前workspace是首次加载工程,SDK会进入启动界面 点击Import Project,导入已有工程 点击Browse,添加工程路径,一个完整的工程包含一个bsp文件夹,一个HW文件夹,和一个src文件夹(添加C功能函数) 点击Fini...

Autumn_He的博客 1万+

S7-1200中通过MODBUS TCP客户端在一次请求中实现从服务器读写一个或多个保持性寄存器的具体方法

S7-1200中通过MODBUS TCP客户端在一次请求中实现从服务器读写一个或多个保持性寄存器的具体方法

Robot_PLC_HMI_Automation 4220

【C语言数据结构】双链表详解(带头双向循环链表)

我们把要存放的数据类型重命名,接着定义一个含有三个参数的结构体,分别用于存放数据,指向下一节点与指向上一节点。}ListNode;我们在进行插入操作以及建立头节点的时候都需要进行申请节点的操作,因此我们可以把它分装成一个函数。不管是进行插入还是删除操作,我们都需要传入哨兵位头节点,我们可以把哨兵位头节点的创立也分装成一个函数。然后剩下的的就是链表的通用功能:增删查改,pos位置的插入与删除以及链表的销毁。//双链表申请一个新节点// 创建返回链表的头结点// 双向链表打印。

谁在夜里看海.的博客 3727

2026年3月GESP真题及题解(C++七级):物流网络

2026年3月GESP真题及题解(C++七级):物流网络

王老师青少年编程 1110

《数据结构c语言版》之循环链表的表示和实现

创建一个工程 1.新建status.h文件 #ifndef STATUS_H #define STATUS_H //函数结果状态代码 #define TRUE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define INFEASIBLE -1 //不可实行的 #define OVERFLOW -2 //Status 是函数的类型,其值是...

qq_43615815的博客 231

PX4从放弃到精通(二十二):日志

文章目录前言一、下载日志二、ulog转CSV三、利用flightplot软件分析PX4的ulog日志1 windos安装2 ubuntu18.04安装四、使用PlotJuggler分析PX4日志五、设置日志记录条件六、添加自定义日志消息 前言 PX4 1.10以上固件 QGC 一、下载日志 将飞控链接地面站,在下图页面点击“刷新”,即可看到保存的日志(前提是要有TF卡) 选择需要下载的日志,点击右侧的“下载”,然后选择目录即可进行下载,如果想擦除所有的日志,可以点击右侧的“擦除全部” 二、ulog转CS

超维空间科技的博客 6772

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

数据结构——C语言实现无头非循环链表

**C语言实现无头非循环链表** 链表是一种物理存储结构上非连续、非顺序的存储结构,数据元素的逻辑顺序是通过链表中的指针链接次序实现的 。 无头单向非循环链表:结构简单,一般不会单独用来存数据。实际中更多是作为其他数据结构的子结构,如哈希桶、图的邻接表等等。另外这种结构在笔试面试中出现很多。 函数接口(Singlelist.h)文件: typedef int SLTDatatype; t...

我爱吃香锅的博客 256

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

【数据结构:链表】——带头双向循环链表的实现(C语言)

本片接上一篇【数据结构:链表】——无头单向非循环链表的实现(C语言) 1、链表实现 带头双向循环链表: 带头双向循环链表:结构最复杂,一般用在单独存储数据。实际中使用的链表数据结构,都是带头双向 循环链表。另外这个结构虽然结构复杂,但是使用代码实现以后会发现结构会带来很多优势,实现反而 简单了,后面我们代码实现了就知道了。 2、代码实现 从上图我们可以看出双向链表的节点数据结构就有了些许不同...

紫阳战君的博客 756

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

数据结构双向循环链表Linux Ubuntu 下的C语言实现

大家好,我是练习编程时长两年半的昆工第一ikun,昨天咋们聊了单向循环链表,今天咋们来实现双向奔赴,也就是双向循环链表,话不多说,直接上代码。

weixin_65155181的博客 721

数据结构C语言版:线性表之循环链表

数据结构C语言版:线性表之循环链表 个人的学习笔记,如有不合理之处欢迎指正,谢谢! 自己写的代码(我本人觉得只有插入、删除有一丢丢复杂,所以只写了这两种操作的代码) #include<stdio.h> typedef struct Node { int data; struct Node* next; }CLL; // 初始化 CLL* InitList(CLL* L) { L = (CLL*)malloc(sizeof(CLL)); L->next = L; // 初始化的时

Code_Mei 176

c语言循环语句实例next,C语言数据结构之双向循环链表的实例

数据结构之双向循环链表实例代码:#include #include #include typedef struct Node{struct Node *pNext;int data;struct Node *prior;} NODE,*PNODE;PNODE CreatList();void TreNode(PNODE pHead);bool isEmpty(PNODE pHead);int ge...

weixin_29696999的博客 205

【C语言数据结构】04.双循环链表

- 本节主要进行C语言数据结构**双循环链表**的学习。

不僈的博客 477

数据结构_循环链表(C语言)

循环链表 1.结构解析 循环链表是另一种形式的链式存贮结构。它的特点是表中最后一个结点的指针域指向头结点,整个链表形成一个环。 图示: 2.源代码: #include<stdio.h> #include<stdlib.h> typedef char ElemType; typedef struct CNode { ElemType data; struct CNode *next; }CNode, *CLinkList; void InitList(CLinkList

小黯 990

数据结构之循环链表(c语言实现)

循环链表 形成:将单链表中的尾节点的指针端指向头节点,这样整个单链表形成了一个环,因此称为单循环链表,也叫循环链表。 来个空表和非空表的图 循环链表的插入和删除和单链表很相似,就不详细介绍了 再来个合并 rearA 和 rearB 两个循环链表的图 代码篇 #include <stdio.h> #include <stdlib.h> typedef int E...

mrslxw的博客 3145

数据结构C语言版:线性表之双循环链表

数据结构C语言版:线性表之双循环链表 个人的学习笔记,如有不合理之处欢迎指正,谢谢! 自己写的代码(我本人觉得只有插入、删除有一丢丢复杂,所以只写了这两种操作的代码) #include<stdio.h> typedef struct Node { int data; struct Node* next, * last; }DCLL; // 初始化 DCLL* InitList(DCLL* L) { L = (DCLL*)malloc(sizeof(DCLL)); L->next

Code_Mei 182

《数据结构》(C语言版)——循环链表

/* run this program using the console pauser or add your own getch, system("pause") or input loop */ // 用到的库文件 #include &lt;stdio.h&gt; // printf();scanf() #include &lt;stdlib.h&gt; // exit() #includ...

prlhnxx的博客 471

c语言数据结构双向循环链表操作题目

【问题描述】输入n个整数,创建一个双向循环链表进行存储。这些整数从第二个开始,递增有序(设a2<a3<...<an) (ai为第i个整数)。试编写程序,创建双向循环链表,依次将输入的整数存储在该链表的各节点中。然后,将第一个结点删除并插入链表中的适当位置,使整个链表递增有序。 【输入形式】先输入整数的个数,再输入整数列。 【输出形式】以整数递增的顺序,依次输出双向循环链表各个节点...

Starry_皮皮星 2921
上一篇: 数据结构之链表(C语言)
下一篇: 字符串函数模拟实现(C语言)
红鼻子怡宝
博客等级 码龄4年 319粉丝 28原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值