【数据结构】周末作业

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;

相关推荐
君鼎14 分钟前
muduo库TcpServer模块详解
linux·网络·c++
卡戎-caryon29 分钟前
【MySQL】02.数据库基础
linux·网络·数据库·mysql·存储引擎
无敌的牛1 小时前
Linux梦开始的地方
linux·运维·服务器
laocui11 小时前
Ubuntu22.04开机运行程序
linux·运维·服务器
JeffersonZU2 小时前
【数据结构】2-3-1单链表的定义
数据结构·链表
JeffersonZU2 小时前
【数据结构】1-4算法的空间复杂度
c语言·数据结构·算法
遇见火星2 小时前
Linux 防火墙 firewalld 实战配置教程!
linux·防火墙·firewalld
卡戎-caryon2 小时前
【Linux网络与网络编程】12.NAT技术&&内网穿透&&代理服务
linux·运维·服务器·网络·网络协议·https
L_cl2 小时前
【Python 算法零基础 4.排序 ① 选择排序】
数据结构·算法·排序算法
朱包林2 小时前
day10-别名-MD5,aide-堡垒机
linux·运维·安全·ubuntu·centos·云计算