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;
}
相关推荐
Queenie_Charlie39 分钟前
前缀和的前缀和
数据结构·c++·树状数组
念越4 小时前
数据结构:栈堆
java·开发语言·数据结构
dear_bi_MyOnly5 小时前
【多线程——线程状态与安全】
java·开发语言·数据结构·后端·中间件·java-ee·intellij-idea
浪客灿心5 小时前
list_stack_queue
数据结构·list
zh_xuan5 小时前
最小跳跃次数
数据结构·算法
zh_xuan6 小时前
单青蛙跳台阶
数据结构·算法
罗湖老棍子7 小时前
【 例 1】石子合并(信息学奥赛一本通- P1569)
数据结构·算法·区间dp·区间动态规划·分割合并
小高Baby@7 小时前
JSON、bind、form
数据结构·json
数智工坊10 小时前
【数据结构-栈】3.1栈的顺序存储-链式存储
java·开发语言·数据结构
执着25910 小时前
力扣102、二叉树的层序遍历
数据结构·算法·leetcode