【数据结构】周末作业

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.struct list_head* p=prev->next;

prev->next=p->next;

p->next->prev=prev;

free(temp);

temp=NULL;

return;

  1. struct list_head* 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;

相关推荐
AR-26710-6 分钟前
Linux Day24——TCP/IP分层与封装
linux·运维
该逃避避7 分钟前
如何利用代理IP进行更好广告验证?
linux·服务器·网络
长不大的杨瑞杰12 分钟前
Windows 安装 OpenCode v2:原生、WSL、Desktop 怎么选?完整配置与避坑指南
人工智能·windows·ai agent·opencode
水饺编程43 分钟前
第2章:Linux 基础,重启命令
linux·c语言·汇编
傅科摆 _ py1 小时前
链表力扣复习
数据结构·leetcode·链表
金色熊族1 小时前
在Qt中使用asan检测内存泄漏(一)
linux·qt·asan
第404号工位1 小时前
“已彻底删除”的照片与文件到底去哪了?我用底层扇区扫描,扒出手机和电脑的幽灵数据
linux·python·架构
Misnice2 小时前
Python 内置函数大全
开发语言·windows·python
硅基手札2 小时前
SPI技术系列 12 · SPI 设备驱动实战
linux·驱动开发·单片机·嵌入式硬件·mcu·性能优化·系统架构