【数据结构】周末作业

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;

相关推荐
好易学·数据结构10 分钟前
可视化图解算法73:跳台阶(爬楼梯)
数据结构·算法·leetcode·动态规划·笔试
天天进步201511 分钟前
CentOS 实战:如何查看和分析信号量 (Semaphore) 的值
linux·运维·centos
Tisfy15 分钟前
LeetCode 3433.统计用户被提及情况:(大)模拟
linux·算法·leetcode
wjykp23 分钟前
2.linux基础命令
linux·运维·服务器
weixin_4492900123 分钟前
Ubuntu 系统上安装和配置 Go 语言运行环境
linux·ubuntu·golang
Hard but lovely24 分钟前
linux: gdb调试器
linux·运维·服务器
贾亚超24 分钟前
【s3c2440】【驱动篇】字符设备驱动
linux·驱动开发
李嘉真32 分钟前
使用Ventoy制作U盘WindowsToGo系统,让电脑从U盘启动和使用多种系统
运维·windows
吃不饱的得可可33 分钟前
【Linux】mmap文件映射的使用
linux·开发语言·c++
长安er35 分钟前
LeetCode 98. 验证二叉搜索树 解题总结
java·数据结构·算法·leetcode·二叉树·力扣