【数据结构】周末作业

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;

相关推荐
是小胡嘛4 小时前
C++之Any类的模拟实现
linux·开发语言·c++
口袋物联5 小时前
设计模式之工厂模式在 C 语言中的应用(含 Linux 内核实例)
linux·c语言·设计模式·简单工厂模式
百***86465 小时前
新版 WSL2 2.0 设置 Windows 和 WSL 镜像网络教程
windows
qq_479875436 小时前
X-Macros(1)
linux·服务器·windows
笨笨聊运维7 小时前
CentOS官方不维护版本,配置python升级方法,无损版
linux·python·centos
王 富贵7 小时前
Conda常用命令大全
windows·conda
HIT_Weston8 小时前
39、【Ubuntu】【远程开发】拉出内网 Web 服务:构建静态网页(二)
linux·前端·ubuntu
weixin_457760008 小时前
Python 数据结构
数据结构·windows·python
q***13618 小时前
Windows操作系统部署Tomcat详细讲解
java·windows·tomcat
明洞日记9 小时前
【数据结构手册002】动态数组vector - 连续内存的艺术与科学
开发语言·数据结构·c++