数据结构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

相关推荐
overmind10 分钟前
oeasy Python 121[专业选修]列表_多维列表运算_列表相加_列表相乘
java·windows·python
_深海凉_32 分钟前
LeetCode热题100-最小栈
java·数据结构·leetcode
Vanranrr2 小时前
Windows 环境下 SVN 命令行能力补齐:一次工程化排障与标准化实践
windows·svn
_深海凉_2 小时前
LeetCode热题100-除了自身以外数组的乘积
数据结构·算法·leetcode
xiaotao1312 小时前
01-编程基础与数学基石: Python核心数据结构完全指南
数据结构·人工智能·windows·python
m0_738120724 小时前
渗透测试基础ctfshow——Web应用安全与防护(五)
前端·网络·数据库·windows·python·sql·安全
路由侠内网穿透.5 小时前
本地部署开源客服系统 FreeScout 并实现外部访问( Windows 版本)
运维·服务器·网络·windows·网络协议
zhangzeyuaaa5 小时前
从Windows到Linux:Shell脚本“无法执行:找不到需要的文件”问题深度解析与根治方案
linux·运维·windows
浅念-6 小时前
从LeetCode入门位运算:常见技巧与实战题目全解析
数据结构·数据库·c++·笔记·算法·leetcode·牛客
剑挑星河月7 小时前
763.划分字母区间
数据结构·算法·leetcode