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

机票网站制作怎么搭建一个电商平台

机票网站制作,怎么搭建一个电商平台,如何申请一个网站空间,海南做网站的🌈个人主页:羽晨同学 💫个人格言:“成为自己未来的主人~” 队列 队列的概念及结构 队列:只允许在一端进行插入数据操作,在另一端进行删除删除数据操作的特殊线性表,队列具有先进先出FIFO,…

🌈个人主页:羽晨同学 

💫个人格言:“成为自己未来的主人~”  

队列

队列的概念及结构

队列:只允许在一端进行插入数据操作,在另一端进行删除删除数据操作的特殊线性表,队列具有先进先出FIFO,进行插入操作的一端称为队尾,进行删除操作的一端称为队头

队列的实现

队列也可以数组和链表的结构实现,使用链表的结构实现更优一点,因为如果使用数组的结构,出队列在数组头上出数据,效率会比较低

#pragma once
#include<stdio.h>
#include<stdbool.h>
#include<assert.h>typedef int QDataType;
typedef struct QueueNode
{int 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 QueueEmpth(Queue* pq);
int QueueSize(Queue* pq);
#define _CRT_SECURE_NO_WARNINGS
#include"code.4.5.Queue.h"
void QueueInit(Queue* pq) {assert(pq);pq->phead = NULL;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->ptail){pq->ptail->next = newnode;pq->ptail = newnode;}pq->size++;
}
void QueuePop(Queue* pq)
{assert(pq);assert(pq->phead != NULL);if (pq->phead->next == NULL) {free(pq->phead);pq->phead = pq->ptail = NULL;}else{QNode* next = pq->phead->next;free(pq->phead);pq->phead = next;}pq->size--;
}QDataType QueueFront(Queue* pq) {assert(pq);assert(pq->phead != NULL);return pq->phead->val;
}
QDataType QueueBack(Queue* pq) {assert(pq);assert(pq->ptail != NULL);return pq->ptail->val;
}
bool QueueEmpth(Queue* pq)
{assert(pq);return pq->size == 0;
}
int QueueSize(Queue* pq)
{assert(pq);return pq->size;
}
#define _CRT_SECURE_NO_WARNINGS
#include"code.4.5.stack.h"
//int main() {
//	ST s;
//	STInit(&s);
//	STPush(&s,1);
//	STPush(&s,2);
//	STPush(&s,3);
//	int top = STTop(&s);
//	printf("%d", top);
//
//	STDestroy(&s);
//	return 0;
//}
#include"code.4.5.Queue.h"
int main()
{Queue q;QueueInit(&q);QueuePush(&q, 1);QueuePush(&q, 2);printf("%d ", QueueFront(&q));QueuePop(&q);QueuePush(&q, 3);QueuePush(&q, 4);while (!QueueEmpth(&q)){printf("%d ", QueueFront(&q));QueuePop(&q);}QueueDestroy(&q);return 0;
}

http://www.yayakq.cn/news/463454/

相关文章:

  • 设计做任务的网站网站优化毕业设计
  • 烟台做网站案例电脑培训班附近有吗
  • 企业网站开发用什么好app设计模板网站
  • 免费注册帐号成都网站搜索排名优化哪家好
  • 延安做网站电话陕西省建设网三类人员题库
  • 北京小程序网站制作云南省建设厅定额网站
  • 连云港建设局电力网站wordpress 1核2g的服务器卡
  • 专门做产品推广ppt的网站国外做图片识别训练的网站
  • 东莞住房和建设局网站郑州做网站网站建设费用
  • 公司中英文网站wordpress 自建模板
  • 网站的种类wordpress建社区
  • 宿迁网站建设开发wordpress企业培训
  • wap网站开发价钱企业网站建设公司电话
  • 赣州市住房和城乡建设局网站娄底网站优化
  • 自己怎样建设淘宝返现网站为企业做好服务保障
  • 广州网站建设报价表网站开发预留接口
  • 钢材销售网站建设5118和百度指数
  • 网站分为哪几个部分网站建设 会议主持稿
  • 某鲜花网站的数据库建设网站备案 类型
  • dw做网站站点中国互联网协会举报中心
  • 设计公司企业站品牌网络seo方案外包
  • wordpress站长广州市网站建设公司
  • 定制网站开发广安广播电台网络架构图
  • 免费建一级域名网站qq恢复官方网站
  • 做推广又能做网站网站建设入门教程pdf
  • 网站外网访问怎么做路由器端口映射淘宝客网站开发需求书
  • wordpress改站点标题网页小游戏在线玩4399
  • 网站建设 东道网络app和网站开发哪个难
  • 微商网站怎么做提供网站设计收费标准
  • html5培训网站模板学生想搭建网站怎么做