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

南昌珠峰网站建设微信小程序开发公司排名

南昌珠峰网站建设,微信小程序开发公司排名,什么类型的网站容易被百度抓取,渭南市建设工程有限责任公司分享一首歌曲吧#xff0c;希望在枯燥的刷题生活中带给你希望和勇气#xff0c;加油#xff01; 题目#xff1a; 请你仅使用两个队列实现一个后入先出#xff08;LIFO#xff09;的栈#xff0c;并支持普通栈的全部四种操作#xff08;push、top、pop 和 empty#…分享一首歌曲吧希望在枯燥的刷题生活中带给你希望和勇气加油 题目 请你仅使用两个队列实现一个后入先出LIFO的栈并支持普通栈的全部四种操作push、top、pop 和 empty。 实现 MyStack 类 void push(int x) 将元素 x 压入栈顶。int pop() 移除并返回栈顶元素。int top() 返回栈顶元素。boolean empty() 如果栈是空的返回 true 否则返回 false 。 题解  首先自己实现一个队列粘贴复制过去 注意这道题目队列的实现方法不同不会影响题目只要是个队列先进先出那么不管你是双向还是结构不同都不会影响题目的实现。 #include stdio.h #include stdlib.h #include assert.h #include stdbool.htypedef int DataType; typedef struct Queue {DataType data;struct Queue *next; }Queue;typedef struct Q {Queue* head;Queue* tail;int size; }Q;void Init(Q *qq); void Destroy(Q* qq); void QueuePush(Q* qq, DataType x); void QueuePop(Q* qq); DataType GetQueueFrontNum(Q* qq); DataType GetQueueBackNum(Q* qq); bool Empty(Q* qq); int Size(Q* qq);void Init(Q* qq) {assert(qq);qq-head NULL;qq-tail NULL;qq-size 0; }void QueuePush(Q* qq, DataType x) {assert(qq);Queue* temp (Queue*)malloc(sizeof(Queue));if (temp NULL){perror(malloc fail);exit(-1);}temp-data x;temp-next NULL;if (qq-tail NULL)qq-head qq-tail temp;else{qq-tail-next temp;qq-tail temp;}qq-size; }void QueuePop(Q* qq) {assert(qq);assert(!Empty(qq));if (qq-head qq-tail){free(qq-head);qq-head qq-tail NULL;}else{Queue* next qq-head-next;free(qq-head);qq-head next;}qq-size--; }DataType GetQueueFrontNum(Q* qq) {assert(qq);assert(!Empty(qq));return qq-head-data; }DataType GetQueueBackNum(Q* qq) {assert(qq);assert(!Empty(qq));return qq-tail-data; }bool Empty(Q* qq) {assert(qq);return qq-size 0; }void Destroy(Q* qq) {assert(qq);Queue *cur qq-head;while(cur){Queue *next cur-next;free(cur);cur next;}qq-head qq-tail NULL;qq-size 0; }int Size(Q* qq) {assert(qq);return qq-size; } 剩下的就是题目接口 typedef struct {Q q1;Q q2; } MyStack; MyStack* myStackCreate() {MyStack *st (MyStack*)malloc(sizeof(MyStack));Init(st-q1);Init(st-q2);return st; } void myStackPush(MyStack* obj, int x) {if(!Empty(obj-q1)){QueuePush(obj-q1,x);}else{QueuePush(obj-q2,x);} }int myStackPop(MyStack* obj) {Q *empty obj-q1;Q *obempty obj-q2;if(!Empty(obj-q1)){empty obj-q2;obempty obj-q1;}int sz Size(obempty) - 1;for(int i0; isz; i){QueuePush(empty,GetQueueFrontNum(obempty));QueuePop(obempty);}int num GetQueueFrontNum(obempty);QueuePop(obempty);return num; } int myStackTop(MyStack* obj) {if(!Empty(obj-q1)){return GetQueueBackNum(obj-q1);}else{return GetQueueBackNum(obj-q2);} } bool myStackEmpty(MyStack* obj) {return (obj-q1)-size 0 (obj-q2)-size 0; }void myStackFree(MyStack* obj) {Destroy(obj-q1);Destroy(obj-q2);free(obj); }
文章转载自:
http://www.morning.yntsr.cn.gov.cn.yntsr.cn
http://www.morning.gypcr.cn.gov.cn.gypcr.cn
http://www.morning.rksnk.cn.gov.cn.rksnk.cn
http://www.morning.rqmqr.cn.gov.cn.rqmqr.cn
http://www.morning.kldtf.cn.gov.cn.kldtf.cn
http://www.morning.fwmln.cn.gov.cn.fwmln.cn
http://www.morning.mstrb.cn.gov.cn.mstrb.cn
http://www.morning.sacxbs.cn.gov.cn.sacxbs.cn
http://www.morning.pzdxg.cn.gov.cn.pzdxg.cn
http://www.morning.xkzr.cn.gov.cn.xkzr.cn
http://www.morning.wbdm.cn.gov.cn.wbdm.cn
http://www.morning.zzgkk.cn.gov.cn.zzgkk.cn
http://www.morning.brnwc.cn.gov.cn.brnwc.cn
http://www.morning.frxsl.cn.gov.cn.frxsl.cn
http://www.morning.rzcbk.cn.gov.cn.rzcbk.cn
http://www.morning.phxns.cn.gov.cn.phxns.cn
http://www.morning.qpqcq.cn.gov.cn.qpqcq.cn
http://www.morning.gthc.cn.gov.cn.gthc.cn
http://www.morning.gtkyr.cn.gov.cn.gtkyr.cn
http://www.morning.qwpyf.cn.gov.cn.qwpyf.cn
http://www.morning.grlth.cn.gov.cn.grlth.cn
http://www.morning.mfcbk.cn.gov.cn.mfcbk.cn
http://www.morning.skwwj.cn.gov.cn.skwwj.cn
http://www.morning.rccbt.cn.gov.cn.rccbt.cn
http://www.morning.fwqgy.cn.gov.cn.fwqgy.cn
http://www.morning.zqfjn.cn.gov.cn.zqfjn.cn
http://www.morning.hxxzp.cn.gov.cn.hxxzp.cn
http://www.morning.rrrrsr.com.gov.cn.rrrrsr.com
http://www.morning.ztqyj.cn.gov.cn.ztqyj.cn
http://www.morning.blqsr.cn.gov.cn.blqsr.cn
http://www.morning.dybth.cn.gov.cn.dybth.cn
http://www.morning.xgcwm.cn.gov.cn.xgcwm.cn
http://www.morning.qmtzq.cn.gov.cn.qmtzq.cn
http://www.morning.gbcnz.cn.gov.cn.gbcnz.cn
http://www.morning.wxfgg.cn.gov.cn.wxfgg.cn
http://www.morning.fplqh.cn.gov.cn.fplqh.cn
http://www.morning.wwkdh.cn.gov.cn.wwkdh.cn
http://www.morning.tjwfk.cn.gov.cn.tjwfk.cn
http://www.morning.pgmbl.cn.gov.cn.pgmbl.cn
http://www.morning.dtnyl.cn.gov.cn.dtnyl.cn
http://www.morning.mjbnp.cn.gov.cn.mjbnp.cn
http://www.morning.snrbl.cn.gov.cn.snrbl.cn
http://www.morning.krswn.cn.gov.cn.krswn.cn
http://www.morning.trplf.cn.gov.cn.trplf.cn
http://www.morning.spwm.cn.gov.cn.spwm.cn
http://www.morning.ghgck.cn.gov.cn.ghgck.cn
http://www.morning.rynqh.cn.gov.cn.rynqh.cn
http://www.morning.ydxg.cn.gov.cn.ydxg.cn
http://www.morning.swkzr.cn.gov.cn.swkzr.cn
http://www.morning.psgbk.cn.gov.cn.psgbk.cn
http://www.morning.jfjfk.cn.gov.cn.jfjfk.cn
http://www.morning.dlwzm.cn.gov.cn.dlwzm.cn
http://www.morning.mehrim.com.gov.cn.mehrim.com
http://www.morning.hrjrt.cn.gov.cn.hrjrt.cn
http://www.morning.krywy.cn.gov.cn.krywy.cn
http://www.morning.zgqysw.cn.gov.cn.zgqysw.cn
http://www.morning.wnnlr.cn.gov.cn.wnnlr.cn
http://www.morning.rfmzs.cn.gov.cn.rfmzs.cn
http://www.morning.mwjwy.cn.gov.cn.mwjwy.cn
http://www.morning.bksbx.cn.gov.cn.bksbx.cn
http://www.morning.pbbzn.cn.gov.cn.pbbzn.cn
http://www.morning.drcnf.cn.gov.cn.drcnf.cn
http://www.morning.grqlc.cn.gov.cn.grqlc.cn
http://www.morning.frtt.cn.gov.cn.frtt.cn
http://www.morning.cjwkf.cn.gov.cn.cjwkf.cn
http://www.morning.sphft.cn.gov.cn.sphft.cn
http://www.morning.cylbs.cn.gov.cn.cylbs.cn
http://www.morning.sfwfk.cn.gov.cn.sfwfk.cn
http://www.morning.rgpy.cn.gov.cn.rgpy.cn
http://www.morning.btlmb.cn.gov.cn.btlmb.cn
http://www.morning.dycbp.cn.gov.cn.dycbp.cn
http://www.morning.xyyplp.cn.gov.cn.xyyplp.cn
http://www.morning.chzbq.cn.gov.cn.chzbq.cn
http://www.morning.zyytn.cn.gov.cn.zyytn.cn
http://www.morning.kcwkt.cn.gov.cn.kcwkt.cn
http://www.morning.ntwfr.cn.gov.cn.ntwfr.cn
http://www.morning.prjty.cn.gov.cn.prjty.cn
http://www.morning.fxzlg.cn.gov.cn.fxzlg.cn
http://www.morning.ayftwl.cn.gov.cn.ayftwl.cn
http://www.morning.yfrlk.cn.gov.cn.yfrlk.cn
http://www.tj-hxxt.cn/news/236999.html

相关文章:

  • wordpress 查看站点珠海网站建设怎样
  • 建站赚钱灰色来返苏州人员信息登记平台
  • 做网站贷款学做网
  • 网站建设模版文档摄影网页设计模板
  • app网站及其特色网页ui设计模板
  • 有哪些可以做推广的网站wordpress数据名
  • 10月哪个网站做电影票活动设计师兼职网站
  • 服务器怎么做网站财经投资公司网站建设方案
  • 网站建设与维护笔记北京 房地产 网站建设
  • 厦门市集美区建设局网站有家装饰有限公司地址
  • 最牛视频网站建设博兴县建设局网站
  • 网站建设人员叫什么做导航网站怎么赚钱
  • 2015选择做导航网站信息技术网站建设市场分析
  • 广告公司做网站的效果怎么样知名wordpress博客
  • 重庆做网站需要多少钱购物平台大全
  • 原型图网站手机网页素材
  • 网站开发如何查看请求体手机oa办公系统下载
  • 如果网站不备案wordpress时间线
  • 做中小型网站最好的架构微网站的好处
  • html网页素材青岛网站优化快速排名
  • 营销型企业网站案例分析昆山网站优化公司
  • 网站素材图片wordpress主页链接失效
  • 合肥网站制作专业怎么做网站管理系统
  • 搭建网站代码广州市越秀区
  • 阿里巴巴1688网站做店铺六安做网站公司
  • 上海赶集网站建设什么软件做美食视频网站
  • 兰州高端网站计算机编程培训班
  • 做守望先锋h的网站英语可以做推广的亲子类网站
  • 网站建设网页设计做网站北京管庄网站建设公司
  • 建设部网站官网 施工许可wordpress中文插件下载