数据结构2月25日

第一道:

第二道:

1、插入到prev和next中间

1.new=(struct list_head*)malloc(sizeof(struct list_head*));

if(new==NULL)

{

printf("失败\n");

return;

}

new->next=prev->next;

prev->next=new;

return;

2、删除prve和next中间那个

2.struct list_head* p=prev->next;

prev->next=p->next;

p->next->prev=prev;

free(temp);

temp=NULL;

return;

插入到队尾

  1. struct list_head3* temp = (struct list_head*)malloc(sizeof(struct list_head*));

if(temp==NULL)

{

printf("结点申请失败,插入失败\n");

return;

}

struct list_head* p=head;

while(p->next!=NULL)

{

p=p->next;

}

temp->next=NULL;

p->next=temp;

temp->prev=p;

return;

  1. entry->next->prev=entry->prev;

entry->prev->next=entry->next;

free(entry);

entry=NULL;

return;

判断是否为空

  1. if(head->next==NULL)

{

printf("链表为空\n");

}

return;


版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原文链接:https://blog.csdn.net/m0_67565143/article/details/136286971

相关推荐
Sam_Deep_Thinking2 小时前
学数据结构到底有什么用
数据结构
сокол4 小时前
【网安-应急响应-基础记录】Windows入侵排查
windows·web安全·网络安全·系统安全
Bruce_Liuxiaowei4 小时前
Windows防火墙规则导出工具:让安全配置可备份、可迁移、可审计
运维·windows·安全·网络安全
x***r1515 小时前
Postman-win64-7.3.5-Setup安装步骤详解(附接口测试入门教程)
windows
py有趣6 小时前
力扣热门100题之和为K的子数组
数据结构·算法·leetcode
无名咸鱼6 小时前
cursor节省token工具-RTK (windows安装)
windows
hipolymers6 小时前
C语言怎么样?难学吗?
c语言·数据结构·学习·算法·编程
dLYG DUMS6 小时前
SQLMAP的下载安装和使用(Windows)
windows
CS创新实验室6 小时前
从“跑得动”到“跑得稳”:深度剖析数据结构究竟是理论点缀还是核心战力?
数据结构
十五年专注C++开发7 小时前
MobaXterm:Windows 远程工作全能工具箱
linux·windows·mobaxterm