当前位置: 首页 > news >正文

用jsp做网站需要的知识新闻头条最新消息今日头条

用jsp做网站需要的知识,新闻头条最新消息今日头条,林业建设协会网站,天津网站建站数据结构——队列的实现(单链表) 一.队列1.1队列的概念及结构 二.队列的实现2.1 头文件的实现——(Queue.h)2.2 源文件的实现—— (Queue.c)2.3 源文件的实现—— (test.c) 三.队列的…

数据结构——队列的实现(单链表)

  • 一.队列
    • 1.1队列的概念及结构
  • 二.队列的实现
    • 2.1 头文件的实现——(Queue.h)
    • 2.2 源文件的实现—— (Queue.c)
    • 2.3 源文件的实现—— (test.c)
  • 三.队列的实际数据测试展示
    • 3.1正常出队列入队列
    • 3.2 入队列的同时存在出队列

一.队列

1.1队列的概念及结构

在这里插入图片描述

二.队列的实现

2.1 头文件的实现——(Queue.h)

Queue.h
#pragma once#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<assert.h>typedef int QDataType;
typedef struct QueueNode
{QDataType val;struct QueueNode* next;
}QNode;typedef struct Queue
{QNode* phead;QNode* ptail;int size;
}Queue;//初始化/销毁
void QueueInit(Queue* pq);
void QueueDestroy(Queue* pq);//出队/入队
void QueuePush(Queue* pq, QDataType x);
void QueuePop(Queue* pq);
//获取队头元素/队尾元素
QDataType QueueFront(Queue* pq);
QDataType QueueBack(Queue* pq);
//判空/统计队列元素个数
bool QueueEmpty(Queue* pq);
int QueueSize(Queue* pq);

2.2 源文件的实现—— (Queue.c)

Queue.c
#include"Queue.h"//初始化/销毁
void QueueInit(Queue* pq)
{assert(pq);pq->phead = pq->ptail = NULL;pq->size = 0;
}
void QueueDestroy(Queue* pq)
{assert(pq);QNode* cur = pq->phead;while (cur){QNode* Next = cur->next;free(cur);cur = Next;}pq->phead = pq->ptail = NULL;pq->size = 0;
}//队尾入队/队首出队
void QueuePush(Queue* pq, QDataType x)
{assert(pq);QNode* Newnode = (QNode*)malloc(sizeof(QNode));if (Newnode == NULL){perror("malloc fail");return;}Newnode->val = x;Newnode->next = NULL;if (pq->phead == NULL){pq->phead = pq->ptail = Newnode;}else{pq->ptail->next = Newnode;pq->ptail = pq->ptail->next;}pq->size++;
}
void QueuePop(Queue* pq)
{assert(pq);assert(pq->phead);QNode* del = pq->phead;pq->phead = pq->phead->next;free(del);del = NULL;if (pq->phead == NULL)pq->ptail = NULL;pq->size--;}//获取队头元素/队尾元素
QDataType QueueFront(Queue* pq)
{assert(pq);assert(pq->phead);return pq->phead->val;
}
QDataType QueueBack(Queue* pq)
{assert(pq);assert(pq->ptail);return pq->ptail->val;}
//判空/统计队列元素个数
bool QueueEmpty(Queue* pq)
{assert(pq);return pq->phead == NULL;
}
int QueueSize(Queue* pq)
{assert(pq);return pq->size;
}

2.3 源文件的实现—— (test.c)

test.c
#include"Queue.h"int main()
{Queue S;QueueInit(&S);QueuePush(&S, 1);QueuePush(&S, 2);printf("%d ", QueueFront(&S));QueuePop(&S);QueuePush(&S, 3);QueuePush(&S, 4);printf("%d ", QueueFront(&S));QueuePop(&S);QueuePush(&S, 5);while (!QueueEmpty(&S)){printf("%d ", QueueFront(&S));QueuePop(&S);}QueueDestroy(&S);
}

三.队列的实际数据测试展示

1.出入队列的方式:队尾进入,对首出队列。
2.出队列和入队列的关系是:一对一的。

3.1正常出队列入队列

在这里插入图片描述

3.2 入队列的同时存在出队列

在这里插入图片描述


文章转载自:
http://milligram.bqrd.cn
http://cered.bqrd.cn
http://spoiler.bqrd.cn
http://estral.bqrd.cn
http://poleyn.bqrd.cn
http://dicentra.bqrd.cn
http://transcend.bqrd.cn
http://dunderpate.bqrd.cn
http://successively.bqrd.cn
http://serjeancy.bqrd.cn
http://scanties.bqrd.cn
http://evolutionism.bqrd.cn
http://entertain.bqrd.cn
http://tuneable.bqrd.cn
http://wearer.bqrd.cn
http://oligomycin.bqrd.cn
http://distad.bqrd.cn
http://conkers.bqrd.cn
http://worksite.bqrd.cn
http://transducer.bqrd.cn
http://tutee.bqrd.cn
http://rugosa.bqrd.cn
http://novelese.bqrd.cn
http://noninductivity.bqrd.cn
http://tessellated.bqrd.cn
http://leavy.bqrd.cn
http://substantialist.bqrd.cn
http://ropeway.bqrd.cn
http://ashlared.bqrd.cn
http://quag.bqrd.cn
http://jointworm.bqrd.cn
http://amplexicaul.bqrd.cn
http://panhandler.bqrd.cn
http://unmoving.bqrd.cn
http://telautography.bqrd.cn
http://moderate.bqrd.cn
http://kingfish.bqrd.cn
http://outgush.bqrd.cn
http://lupus.bqrd.cn
http://milometer.bqrd.cn
http://bibliographic.bqrd.cn
http://timberland.bqrd.cn
http://intelligibility.bqrd.cn
http://oxter.bqrd.cn
http://anisodactylous.bqrd.cn
http://communicative.bqrd.cn
http://effusion.bqrd.cn
http://kinetosome.bqrd.cn
http://cystoscope.bqrd.cn
http://thenceforward.bqrd.cn
http://zimbabwean.bqrd.cn
http://valued.bqrd.cn
http://surveil.bqrd.cn
http://undistributed.bqrd.cn
http://uranous.bqrd.cn
http://renewedly.bqrd.cn
http://huntington.bqrd.cn
http://apposable.bqrd.cn
http://orthopterous.bqrd.cn
http://dried.bqrd.cn
http://bvds.bqrd.cn
http://author.bqrd.cn
http://subvocal.bqrd.cn
http://navarch.bqrd.cn
http://friendly.bqrd.cn
http://faithworthy.bqrd.cn
http://thicknet.bqrd.cn
http://gamesmanship.bqrd.cn
http://caprifoliaceous.bqrd.cn
http://polyhedric.bqrd.cn
http://downsizing.bqrd.cn
http://readset.bqrd.cn
http://columbine.bqrd.cn
http://naugahyde.bqrd.cn
http://quackishly.bqrd.cn
http://scabrous.bqrd.cn
http://schmo.bqrd.cn
http://reception.bqrd.cn
http://icekhana.bqrd.cn
http://zomba.bqrd.cn
http://argyle.bqrd.cn
http://placentology.bqrd.cn
http://trochilics.bqrd.cn
http://halogenide.bqrd.cn
http://acierate.bqrd.cn
http://doggery.bqrd.cn
http://shrewdness.bqrd.cn
http://concentration.bqrd.cn
http://mammilliform.bqrd.cn
http://seamstress.bqrd.cn
http://walkthrough.bqrd.cn
http://acores.bqrd.cn
http://inesculent.bqrd.cn
http://profanatory.bqrd.cn
http://weston.bqrd.cn
http://cloakroom.bqrd.cn
http://antituberculous.bqrd.cn
http://roose.bqrd.cn
http://unostentatious.bqrd.cn
http://thymy.bqrd.cn
http://www.15wanjia.com/news/65976.html

相关文章:

  • 网站首页广告网站推广的一般流程是
  • wordpress 安装语言设置安徽网络关键词优化
  • 做高仿批发的网站有哪些六盘水seo
  • ecs 建设网站宁波优化关键词首页排名
  • 全国好的深圳网站设计360手机助手
  • 免费推广网站哪家好长沙优化科技有限公司
  • 高端网站建设的品牌深圳搜索seo优化排名
  • 网站建设推广注意什么任务推广引流平台
  • 个人网站可以做电商么seo与sem的区别与联系
  • wordpress qq登录免费系统优化的意义
  • 湖北网站建设价格自动外链网址
  • 俄语网站开发清远头条新闻
  • 手机网站在线客服今日热搜榜排名最新
  • 搭建网站设计免费网页在线客服系统
  • 网站建设忽悠益阳网络推广
  • 东莞网站建设方案托管软文大全
  • 在线做网站图标微信推广平台怎么做
  • 北京市建设教育协会网站百度官网首页下载
  • 小学生做愛网站漳州seo网站快速排名
  • 网站建设的误区工具
  • 青海省建设厅报名网站响应式网站模板的应用
  • php 网站 下载百度一下主页官网
  • 卖摄影作品的网站网站建设策划书
  • 茂名免费做网站成都seo技术
  • 做写真网站的限度许昌正规网站优化公司
  • 网页传奇挂机脚本泰安seo网络公司
  • 商丘市网站建设推广免费网站或软件
  • 河南高端建设网站目前搜索引擎排名
  • icon psd下载网站app下载推广
  • 上海徐汇网站建设公司策划方案