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

哈尔滨百度优化搜索关键词优化

哈尔滨百度优化,搜索关键词优化,自己的网站中商城怎么做,深圳做网站建设比较好的公司队列的基本概念 只允许在一端进行插入数据操作,在另一端进行删除数据操作的特殊线性表,队列具有先进先出 入队列:进行插入操作的一端称为队尾 出队列:进行删除操作的一端称为队头 队列用链表实现 队列的实现 队列的定义 队列…

队列的基本概念

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

入队列:进行插入操作的一端称为队尾

出队列:进行删除操作的一端称为队头

队列用链表实现

队列的实现

队列的定义

队列初始化

入队

出队

判断队列是否为空

销毁

队头数据

队尾数据

队列数据

运行调试

完整代码

Queue.h

#pragma once#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <stdbool.h>typedef int QDataType;typedef struct QueueNode
{struct QueueNode* next;QDataType data;
}QNode;typedef struct Queue
{QNode* head;QNode* tail;int size;
}Que;void QueueInit(Que* pst);     //初始化队列void QueuePush(Que* pst,QDataType x);     //入队void QueuePop(Que* pst);          //出队bool QueueEmpty(Que* pst);          //判断队列是否为空int QueueSize(Que* pst);      //队列数据QDataType QueuBack(Que* pst);      //队尾数据QDataType QueueFront(Que* pst);       //队头数据void QueueDestroy(Que* pst);        //销毁队列

Queue.c

#define _CRT_SECURE_NO_WARNINGS 1#include "Queue.h"void QueueInit(Que* pst)     //初始化队列
{assert(pst);pst->head = NULL;pst->tail = NULL;pst->size = 0;}void QueuePush(Que* pst, QDataType x)     //入队
{assert(pst);QNode* newnode = (QNode*)malloc(sizeof(QNode));if (newnode == NULL){perror("malloc failed");exit(-1);}newnode->data = x;newnode->next = NULL;if (pst->tail == NULL){pst->head = newnode;pst->tail = newnode;}else{pst->tail->next = newnode;pst->tail = newnode;}pst->size++;
}void QueuePop(Que* pst)          //出队
{//队列为空assert(pst);assert(!QueueEmpty(pst));//队列只有一个元素if (pst->head->next == NULL){free(pst->head);pst->head = pst->tail = NULL;}//队列多个元素else{QNode* del = pst->head;pst->head = pst->head->next;free(del);}pst->size--;
}bool QueueEmpty(Que* pst)          //判断队列是否为空
{assert(pst);return pst->head == NULL;
}void QueueDestroy(Que* pst)        //销毁队列
{assert(pst);QNode* cur = pst->head;while (cur){QNode* next = cur->next;free(cur);cur = next;}pst->head = NULL;pst->tail = NULL;pst->size = 0;
}QDataType QueueFront(Que* pst)        //队头数据
{assert(pst);assert(!QueueEmpty(pst));return pst->head->data;
}QDataType QueuBack(Que* pst)      //队尾数据
{assert(pst);assert(!QueueEmpty(pst));return pst->tail->data;
}int QueueSize(Que* pst)      //队列数据
{assert(pst);return pst->size;
}

http://www.dt0577.cn/news/2499.html

相关文章:

  • 加强意识形态建设 办好政协网站关键词排名seo
  • 聊城做wap网站价格搜索引擎推广培训
  • wordpress 管理 主题百度竞价推广关键词优化
  • 赣州网站建设哪家便宜制作公司网页多少钱
  • 徐州 网站制作站长之家查询域名
  • 备案网站 备注内容seo网站推广助理招聘
  • 网上做淘宝优惠券的网站靠谱吗seo短视频发布页
  • 合肥网站建设哪家公司好武汉seo网站优化排名
  • 英文网站建设怎么样广州网站优化价格
  • 阿里云网站的logo怎么写进去的青岛网络seo公司
  • 公司规模介绍范文思亿欧seo靠谱吗
  • js网站开发视频站长工具seo综合查询腾讯
  • 新疆建设云网站施工图审查百度怎么推广
  • 广州网络帮助建站全能优化大师
  • 做cpa用单页网站好还是电子营销主要做什么
  • 网站制作的设计思路百度seo关键词优化方案
  • 沈阳定制网络机箱机柜长沙seo服务
  • web网站扫描十大跨境电商erp排名
  • 关于公路建设的网站全网整合营销
  • wordpress 知识 管理系统韶山seo快速排名
  • 潍坊市建设局官方网站线下营销推广方式有哪些
  • 功能网站建设整站seo技术
  • 台湾网友做的二次元炒股网站seo优化培训
  • 网站开发哪个工具好广告关键词有哪些类型
  • 网站后台编辑器控件下载百度知道官网登录入口
  • 网站设计动图怎么建设济南网站建设制作
  • 百丽鞋业网站建设安卓手机优化神器
  • 广州营销型网站建设公司哪家名气大关键词优化推广
  • 手机网页及网站设计优化大师下载
  • 贵金属如何用网站开发客户seo优化技巧