【数据结构】周末作业

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;

相关推荐
彭泽布衣5 分钟前
gdb调试方法总结
linux·c语言·gdb·故障排查·段错误
KL's pig/猪头/爱心/猪头6 分钟前
写一个rv1106的gpio输入驱动(带中断)
linux·驱动开发·rv1106
C雨后彩虹22 分钟前
中文分词模拟器
java·数据结构·算法·华为·面试
Calebbbbb27 分钟前
Windows 向 Vmware Ubuntu 传大文件校验不一致问题完整排查记录
linux·windows·ubuntu
Remember_99329 分钟前
【LeetCode精选算法】二分查找专题二
java·数据结构·算法·leetcode·哈希算法
步菲31 分钟前
Windows系统安装Docker Desktop配置daemon.json不生效问题解决
windows·docker·容器
被遗忘的旋律.31 分钟前
Linux驱动开发笔记(二十四)——(下)IIO + MPU6050驱动
linux·驱动开发·笔记
optimistic_chen44 分钟前
【Redis系列】Redis缓存
linux·数据库·redis·mysql·缓存·火山引擎
czliutz1 小时前
Windows系统创建启动Flask虚拟环境
windows·python·flask
我想发发发1 小时前
.deb格式软件包安装方式(Ubuntu 22.04为例)
linux·运维·ubuntu