【数据结构】周末作业

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;

相关推荐
aidream123913 分钟前
Linux文件操作-文件打包和压缩(tar/gzip/bzip2/xz/zip)
linux·运维·服务器
uNke DEPH28 分钟前
Redis 安装及配置教程(Windows)【安装】
数据库·windows·redis
念恒1230629 分钟前
进程--进程状态(上)
linux·c语言
捞的不谈~31 分钟前
宇树机器狗通过笔记本共享上网操作指南(临时版)
linux·经验分享·tcp/ip·ubuntu
feng_you_ying_li32 分钟前
linux之进程优先与切换调度
linux·运维·服务器
光电笑映36 分钟前
Linux C/C++ 开发工具(上):包管理器、Vim、gcc/g++ 与动静态库
linux·运维·服务器
周末也要写八哥39 分钟前
最长递增子序列典型应用题目详解
数据结构·算法
贺雷8643 分钟前
3. 远程访问Ubuntu
linux·运维·ubuntu
张小姐的猫1 小时前
【Linux】进程信号(质变)—— 信号捕捉 | 中断 | 内核态
linux·运维·服务器·c++
iiiiyu1 小时前
常用API(StringJoiner类 & Math类 & System类)
java·大数据·开发语言·数据结构·编程语言