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

阿里云上可以做网站吗百度一下电脑版首页网址

阿里云上可以做网站吗,百度一下电脑版首页网址,企业网站建设首页要写什么内容,wordpress mail函数在C语言中,.和->运算符用于访问结构体的成员变量。它们之间的区别在于:.运算符用于访问结构体变量的成员。->运算符用于访问结构体指针变量的成员 1a(rear指向队尾元素后一位,判空判满时牺牲一个存储单元) 首先…

在C语言中,.和->运算符用于访问结构体的成员变量。它们之间的区别在于:.运算符用于访问结构体变量的成员。->运算符用于访问结构体指针变量的成员

1a(rear指向队尾元素后一位,判空判满时牺牲一个存储单元)

首先我们考虑1a的情况下在牺牲一个存储单元rear指向队尾元素后一个位置该怎么实现队列的基本操作,当rear指向队尾元素的后一位时,队列的实现需要牺牲一个存储单元来区分队列是空还是满

#include <stdio.h>
#include <stdlib.h>
#define MaxSize 10 // 定义队列中元素的最大个数typedef struct {int data[MaxSize]; // 用静态数组存放队列元素int front, rear; // 队头指针和队尾指针
} SqQueue;// 初始化队列
void InitQueue(SqQueue* Q) {Q->front = Q->rear = 0; // 初始时队头、队尾指针指向0
}// 判断队列是否为空
bool QueueEmpty(SqQueue* Q) {return Q->front == Q->rear; // 判空条件:队头指针等于队尾指针
}// 判断队列是否已满
bool QueueFull(SqQueue* Q) {return (Q->rear + 1) % MaxSize == Q->front; // 判满条件:队尾指针后移一位后等于队头指针
}// 入队
bool EnQueue(SqQueue* Q, int x) {if (QueueFull(Q)) { // 判断队满return false; // 队满报错} else {Q->data[Q->rear] = x; // 新元素插入队尾Q->rear = (Q->rear + 1) % MaxSize; // 队尾指针后移return true;}
}// 出队(删除一个队头元素,并用x返回)
bool DeQueue(SqQueue* Q, int* x) {if (QueueEmpty(Q)) { // 判断队空return false; // 队空则报错} else {Q->front = (Q->front + 1) % MaxSize; // 队头指针后移*x = Q->data[Q->front]; // 获取队头元素return true;}
}// 获得队头元素的值,用x返回
bool GetHead(SqQueue* Q, int* x) {if (QueueEmpty(Q)) { // 判断队空return false; // 队空则报错} else {*x = Q->data[Q->front]; // 获取队头元素return true;}
}

在这个实现中,队列满的条件是队尾指针后移一位后等于队头指针。这意味着队列的实际容量是MaxSize - 1,因为一个存储单元被用来区分队列是空还是满。 

2a(rear指向队尾元素,判空判满时牺牲一个存储单元)

当rear指向队尾元素时,队列的实现不需要牺牲额外的存储单元来区分队列是空还是满。在这种情况下,队列的实际容量就是MaxSize,因为所有的存储单元都可以用来存储元素。

#include <stdio.h>
#include <stdlib.h>
#define MaxSize 10 // 定义队列中元素的最大个数typedef struct {int data[MaxSize]; // 用静态数组存放队列元素int front, rear; // 队头指针和队尾指针
} SqQueue;// 初始化队列
void InitQueue(SqQueue* Q) {// 初始时队头指针指向0// 队尾指针指向数组尾元素Q->front = 0;Q->rear = MaxSize - 1;
}// 判断队列是否为空
bool QueueEmpty(SqQueue* Q) {if (Q->rear == Q->front) { // 判空条件return true;} else {return false;}
}// 判断队列是否已满
bool QueueFull(SqQueue* Q) {if ((Q->rear + 1) % MaxSize == Q->front) { // 判满条件return true;} else {return false;}
}// 入队
bool EnQueue(SqQueue* Q, int x) {if (QueueFull(Q)) { // 判断队满return false; // 队满报错} else {Q->rear = (Q->rear + 1) % MaxSize; // 队尾指针后移Q->data[Q->rear] = x; // 新元素插入队尾return true;}
}// 出队(删除一个队头元素,并用x返回)
bool DeQueue(SqQueue* Q, int* x) {if (QueueEmpty(Q)) { // 判断队空return false; // 队空则报错} else {Q->front = (Q->front + 1) % MaxSize; // 队头指针后移*x = Q->data[Q->front]; // 获取队头元素return true;}
}// 获得队头元素的值,用x返回
bool GetHead(SqQueue* Q, int* x) {if (QueueEmpty(Q)) { // 判断队空return false; // 队空则报错} else {*x = Q->data[(Q->front + 1) % MaxSize]; // 获取队头元素return true;}
}

在这个实现中,队列满的条件是队尾指针后移一位后等于队头指针。这意味着队列的实际容量是MaxSize,因为所有的存储单元都可以用来存储元素 ,与1a的相比主要改变了入队初始化的操作,入队的时候,rear需要先往后一位,再接受新的数据。

1b(rear指向队尾元素后一位,增加size变量记录长度)

#include <stdio.h>
#include <stdlib.h>
#define MaxSize 10 // 定义队列中元素的最大个数typedef struct {int data[MaxSize]; // 用静态数组存放队列元素int front, rear; // 队头指针和队尾指针int size;//增加一个size记录队列的长度
} SqQueue;// 初始化队列
void InitQueue(SqQueue* Q) {// 初始时队头、队尾指针指向0Q->rear = Q->front = 0;Q->size = 0;
}// 判断队列是否为空
bool QueueEmpty(SqQueue Q) {if (Q->size == 0) { // 判空条件return true;}else {return false;}bool QueueFull(SqQueue Q) {if (Q->size==MaxSize) { // 判满条件return true;}else {return false;}
}// 入队
bool EnQueue(SqQueue* Q, int x) {if (QueueFull(*Q)) { // 判断队满return false; // 队满报错}else {Q->data[Q->rear] = x; // 新元素插入队尾Q->rear = (Q->rear + 1) % MaxSize; // 队尾指针加1取模,队尾指针后移Q->size = Q->size + 1; // 队列长度加1return true;}
}// 出队(删除一个队头元素,并用x返回)
bool DeQueue(SqQueue* Q, int* x) {if (QueueEmpty(*Q)) { // 判断队空return false; // 队空则报错}else {*x = Q->data[Q->front];Q->front = (Q->front + 1) % MaxSize; // 队头指针后移Q->size = Q->size - 1; // 队列长度减1return true;}
}
// 获得队头元素的值,用x返回
bool GetHead(SqQueue Q, int* x) {if (QueueEmpty(*Q)) { // 判断队空return false; // 队空则报错}else {*x = Q.data[Q.front];return true;}
}

2b(rear指向队尾元素,增加size变量记录长度)

#include <stdio.h>
#include <stdlib.h>
#define MaxSize 10 // 定义队列中元素的最大个数typedef struct {int data[MaxSize]; // 用静态数组存放队列元素int front, rear; // 队头指针和队尾指针int size;//增加一个size记录队列的长度
} SqQueue;// 初始化队列
void InitQueue(SqQueue* Q) {// 初始时队头、队尾指针指向Q->front = 0;Q->rear = MaxSize - 1;Q->size = 0;
}// 判断队列是否为空
bool QueueEmpty(SqQueue Q) {if (Q->size == 0) { // 判空条件return true;}else {return false;}bool QueueFull(SqQueue Q) {if (Q->size==MaxSize) { // 判满条件return true;}else {return false;}
}// 入队
bool EnQueue(SqQueue* Q, int x) {if (QueueFull(*Q)) { // 判断队满return false; // 队满报错}else {Q->rear = (Q->rear + 1) % MaxSize; // 队尾指针加1取模,队尾指针后移Q->data[Q->rear] = x; // 新元素插入队尾Q->size = Q->size + 1; // 队列长度加1return true;}
}// 出队(删除一个队头元素,并用x返回)
bool DeQueue(SqQueue* Q, int* x) {if (QueueEmpty(*Q)) { // 判断队空return false; // 队空则报错}else {*x = Q->data[Q->front];Q->front = (Q->front + 1) % MaxSize; // 队头指针后移Q->size = Q->size - 1; // 队列长度减1return true;}
}
// 获得队头元素的值,用x返回
bool GetHead(SqQueue Q, int* x) {if (QueueEmpty(*Q)) { // 判断队空return false; // 队空则报错}else {*x = Q.data[Q.front];return true;}
}

3a(rear指向队尾元素后一位,判空判满时添加一个tag标签标记)

#include <stdio.h>
#include <stdlib.h>
#define MaxSize 10 // 定义队列中元素的最大个数typedef struct {int data[MaxSize]; // 用静态数组存放队列元素int front, rear; // 队头指针和队尾指针int tag;//tag标签用于标记,0=出队,1=入队
} SqQueue;// 初始化队列
void InitQueue(SqQueue* Q) {Q->front = Q->rear = 0; // 初始时队头、队尾指针指向0Q->tag = 0;
}// 判断队列是否为空
bool QueueEmpty(SqQueue* Q) {return (Q->front == Q->rear&&Q->tag==0); // 判空条件:队头指针等于队尾指针
}// 判断队列是否已满
bool QueueFull(SqQueue* Q) {return ((Q->rear + 1) % MaxSize == Q->front&&Q->tag==1); // 判满条件:队尾指针后移一位后等于队头指针
}// 入队
bool EnQueue(SqQueue* Q, int x) {if (QueueFull(Q)) { // 判断队满return false; // 队满报错}else {Q->data[Q->rear] = x; // 新元素插入队尾Q->rear = (Q->rear + 1) % MaxSize; // 队尾指针后移Q->tag = 1;//入队后tag变为1;return true;}
}// 出队(删除一个队头元素,并用x返回)
bool DeQueue(SqQueue* Q, int* x) {if (QueueEmpty(Q)) { // 判断队空return false; // 队空则报错}else {Q->front = (Q->front + 1) % MaxSize; // 队头指针后移*x = Q->data[Q->front]; // 获取队头元素Q->tag = 1;//出队后tag变为1;return true;}
}// 获得队头元素的值,用x返回
bool GetHead(SqQueue* Q, int* x) {if (QueueEmpty(Q)) { // 判断队空return false; // 队空则报错}else {*x = Q->data[Q->front]; // 获取队头元素return true;}
}

3b(rear指向队尾元素,判空判满时添加一个tag标签标记)

#include <stdio.h>
#include <stdlib.h>
#define MaxSize 10 // 定义队列中元素的最大个数typedef struct {int data[MaxSize]; // 用静态数组存放队列元素int front, rear; // 队头指针和队尾指针int tag;//tag标签用于标记,0=出队,1=入队
} SqQueue;// 初始化队列
void InitQueue(SqQueue* Q) {Q->front = 0//初始时队头指针指向队头元素Q->rear = MaxSize-1;//初始时队尾指针指向队尾元素Q->tag = 0;
}// 判断队列是否为空
bool QueueEmpty(SqQueue* Q) {return (Q->front == Q->rear && Q->tag == 0); // 判空条件:队头指针等于队尾指针
}// 判断队列是否已满
bool QueueFull(SqQueue* Q) {return ((Q->rear + 1) % MaxSize == Q->front && Q->tag == 1); // 判满条件:队尾指针后移一位后等于队头指针
}// 入队
bool EnQueue(SqQueue* Q, int x) {if (QueueFull(Q)) { // 判断队满return false; // 队满报错}else {Q->rear = (Q->rear + 1) % MaxSize; // 队尾指针后移Q->data[Q->rear] = x; // 新元素插入队尾Q->tag = 1;//入队后tag变为1;return true;}
}// 出队(删除一个队头元素,并用x返回)
bool DeQueue(SqQueue* Q, int* x) {if (QueueEmpty(Q)) { // 判断队空return false; // 队空则报错}else {Q->front = (Q->front + 1) % MaxSize; // 队头指针后移*x = Q->data[Q->front]; // 获取队头元素Q->tag = 1;//出队后tag变为1;return true;}
}// 获得队头元素的值,用x返回
bool GetHead(SqQueue* Q, int* x) {if (QueueEmpty(Q)) { // 判断队空return false; // 队空则报错}else {*x = Q->data[Q->front]; // 获取队头元素return true;}
}


文章转载自:
http://dinncofaecula.stkw.cn
http://dinncospanrail.stkw.cn
http://dinncoaspermous.stkw.cn
http://dinncokinase.stkw.cn
http://dinncotrichinosed.stkw.cn
http://dinncosoupfin.stkw.cn
http://dinncohydrolyzate.stkw.cn
http://dinncoavignon.stkw.cn
http://dinncodistributively.stkw.cn
http://dinncouropygia.stkw.cn
http://dinncoaffiant.stkw.cn
http://dinncoshrove.stkw.cn
http://dinncohylic.stkw.cn
http://dinncoglutei.stkw.cn
http://dinncohydrocarbon.stkw.cn
http://dinncotitter.stkw.cn
http://dinncobilgy.stkw.cn
http://dinncopersian.stkw.cn
http://dinncoevidently.stkw.cn
http://dinncohenna.stkw.cn
http://dinncogarrotte.stkw.cn
http://dinncotethyan.stkw.cn
http://dinncocarbecue.stkw.cn
http://dinncoorion.stkw.cn
http://dinncostationary.stkw.cn
http://dinncodebacle.stkw.cn
http://dinncotransmutable.stkw.cn
http://dinncoaquafarm.stkw.cn
http://dinncoprepay.stkw.cn
http://dinncooverbore.stkw.cn
http://dinncoperpetuity.stkw.cn
http://dinncoforeordination.stkw.cn
http://dinncorosiness.stkw.cn
http://dinncoyenangyaung.stkw.cn
http://dinncosixteenthly.stkw.cn
http://dinncogoldstone.stkw.cn
http://dinncoscreenland.stkw.cn
http://dinncoinanimate.stkw.cn
http://dinncodevouringly.stkw.cn
http://dinncotetraalkyllead.stkw.cn
http://dinncoeccrine.stkw.cn
http://dinncotambourine.stkw.cn
http://dinncoselflessness.stkw.cn
http://dinncocounterrotation.stkw.cn
http://dinncobangui.stkw.cn
http://dinncoaffined.stkw.cn
http://dinncounpolite.stkw.cn
http://dinncoprofess.stkw.cn
http://dinncodiscusser.stkw.cn
http://dinncochildmind.stkw.cn
http://dinncosabian.stkw.cn
http://dinncotamburitza.stkw.cn
http://dinncoschmitt.stkw.cn
http://dinncosiriasis.stkw.cn
http://dinncorhadamanthine.stkw.cn
http://dinncovaginate.stkw.cn
http://dinncounaffectionate.stkw.cn
http://dinncothorp.stkw.cn
http://dinncotod.stkw.cn
http://dinncobra.stkw.cn
http://dinncolucerne.stkw.cn
http://dinncodampish.stkw.cn
http://dinncoforktail.stkw.cn
http://dinncorepetitive.stkw.cn
http://dinncotightly.stkw.cn
http://dinncocomma.stkw.cn
http://dinncorehouse.stkw.cn
http://dinncotightrope.stkw.cn
http://dinncosittang.stkw.cn
http://dinncokintal.stkw.cn
http://dinncokootenay.stkw.cn
http://dinncochemitype.stkw.cn
http://dinncolignitize.stkw.cn
http://dinncomolybdite.stkw.cn
http://dinncofrater.stkw.cn
http://dinncopotboy.stkw.cn
http://dinncotaxpaying.stkw.cn
http://dinncoteutophobe.stkw.cn
http://dinncobragger.stkw.cn
http://dinncocausality.stkw.cn
http://dinncoseniti.stkw.cn
http://dinncohotch.stkw.cn
http://dinncoinfarction.stkw.cn
http://dinncoaudiology.stkw.cn
http://dinncoawane.stkw.cn
http://dinncocicatricle.stkw.cn
http://dinnconapalm.stkw.cn
http://dinncovugular.stkw.cn
http://dinncounlike.stkw.cn
http://dinncospitball.stkw.cn
http://dinncoextractable.stkw.cn
http://dinncocraniology.stkw.cn
http://dinncoclearwing.stkw.cn
http://dinncogowk.stkw.cn
http://dinnconeckcloth.stkw.cn
http://dinncospokespeople.stkw.cn
http://dinncodisequilibrium.stkw.cn
http://dinncointortion.stkw.cn
http://dinncojackstraw.stkw.cn
http://dinncoaccountant.stkw.cn
http://www.dinnco.com/news/123230.html

相关文章:

  • 深圳电商网站益阳网站seo
  • wordpress管理地址seo怎么提升关键词的排名
  • 公司营销型网站公司抖音关键词查询工具
  • 东莞市行政区划图进行优化
  • 做app一定要做网站吗百度平台订单查询
  • 网站建设 网站设计网络推广培训
  • 大型企业的微网站谁做app营销策略都有哪些
  • 网站开发小程序手机百度安装下载
  • 什么网站可以做问卷调查企业网站建设多少钱
  • 罗湖企业网站建设百度推广好不好做
  • 深圳联雅网站建设樱花bt引擎
  • 网站上的信息可以做证据吗阿里云模板建站
  • 网站建设价格就要用兴田德润网站自动推广软件
  • 国内网站开发 框架成都网络营销推广公司
  • 网页设计网站免费谷歌优化的最佳方案
  • 免费游戏网站建设游戏后台自助建站seo
  • 哪些网站可以做化妆品广告百度搜索名字排名优化
  • 海南高端网站建设百度推广优化技巧
  • seo网站建设哪家专业如何创造一个自己的网站
  • 阿里云服务器网站目录视频号怎么付费推广
  • 企业网站建设方案报价星乐seo网站关键词排名优化
  • 软件开发报价单广东seo
  • crm管理系统在线使用抚顺优化seo
  • 怎么做一直弹窗口网站百度关键词推广公司哪家好
  • 网站建设外包流程吴江seo网站优化软件
  • 乔拓云建站平台不是免费的百度云搜索引擎入口 百度网盘
  • 简单做网站的软件优化
  • 彭州网站建设品牌营销策划案例ppt
  • 搜索引擎是网站提供的搜索服务吗武汉seo搜索引擎
  • 莆田网站制作网络营销工程师前景