2.25数据结构作业

cs 复制代码
//1
seqn[tail] = data;
tail = (tail+1)%SEQLEN;

//2
data = seqn[head];
head = (head+1)%SEQLEN;

//3
head = tail;

//4
(tail+1)%SEQLEN == head;

//5
while(head != tail)
{
    tail--;
}

//6
(tail-head+SEQLEN)%SEQLEN;

//7
SEQLEN-1
cs 复制代码
//1
new->next = next;
prev->next = new;

//2
struct list_head* new = prev->next;
prev->next = new->next;
free(new);  new=NULL;

//3
struct list_head* p=head;
while(p->next != NULL)
{
    p=p->next;
}
new->next = p->Next;
p->next = new;

//4
struct list_head* p = head;
while(p->next != entry && p->next != NULL)
{
    p=p->next;
}
p->next = p->next->next;
free(entry); entry=NULL;

//5
if(head->next == NULL)
{
    printf("队列为空\n");
    return 1;
}
else
{
    return 0;
}
相关推荐
z人间防沉迷k19 分钟前
堆(Heap)
开发语言·数据结构·笔记·python·算法
hy.z_77722 分钟前
【数据结构】链表 LinkedList
java·数据结构·链表
ROCKY_81731 分钟前
数据结构——例题3
数据结构
ROCKY_81739 分钟前
数据结构——例题2
数据结构
Akiiiira44 分钟前
【数据结构】队列
java·开发语言·数据结构
XiaoyaoCarter3 小时前
每日一道leetcode(新学数据结构版)
数据结构·c++·算法·leetcode·职场和发展·哈希算法·前缀树
晴空闲雲3 小时前
数据结构与算法-线性表-单链表(Linked List)
数据结构·算法·链表
freyazzr4 小时前
Leetcode刷题 | Day63_图论08_拓扑排序
数据结构·c++·算法·leetcode·图论
一梦浮华4 小时前
自学嵌入式 day 18 - 数据结构 1
数据结构
ai.Neo5 小时前
牛客网NC22015:最大值和最小值
数据结构·c++·算法