【数据结构】周末作业

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;

相关推荐
不能跑的代码不是好代码1 小时前
Linux系统常用命令中文速查表
linux·运维·服务器
youtootech1 小时前
HarmonyOS《柚兔学伴》项目实战09-待办列表 UI——List+ForEach+滑动删除
数据结构·ui·华为·list·harmonyos
石一峰6992 小时前
深入理解 Linux 中断三层机制与 1-Wire 时序锁原理
linux·运维·服务器
:-)2 小时前
算法-归并排序
java·开发语言·数据结构·算法·排序算法
无限码农3 小时前
Linux上通过cmake编译uchardet
linux·运维·服务器
运维大师4 小时前
【Linux运维极简教程】06-网络配置与管理
linux·运维
探索云原生6 小时前
终于搞懂 Kueue:5 个核心对象一次讲透
linux·docker·ai·云原生·kubernetes
An_s7 小时前
机器学习python之识别图中物品信息
java·linux·开发语言
Championship.23.248 小时前
Linux 3.0 LVDS驱动开发详解
linux·运维·驱动开发·lvds
风向决定发型丶8 小时前
Shell中的特殊变量
linux·运维·bash