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

php网站中水印怎么做的可以设计房子布局的软件

php网站中水印怎么做的,可以设计房子布局的软件,北京公司建设网站,松江建设网站题目 请你仅使用两个栈实现先入先出队列。队列应当支持一般队列支持的所有操作#xff08;push、pop、peek、empty#xff09;#xff1a; 实现 MyQueue 类#xff1a; void push(int x) 将元素 x 推到队列的末尾int pop() 从队列的开头移除并返回元素int peek() 返回队列开…题目 请你仅使用两个栈实现先入先出队列。队列应当支持一般队列支持的所有操作push、pop、peek、empty 实现 MyQueue 类 void push(int x) 将元素 x 推到队列的末尾int pop() 从队列的开头移除并返回元素int peek() 返回队列开头的元素boolean empty() 如果队列为空返回 true 否则返回 false 题解 根据栈后进先出的性质可将两个栈分别设置为只压入元素的栈和只弹出元素的栈以此来满足队列先进先出的性质。 代码如下 #include stdio.h #include stdlib.h #include assert.h #include errno.h #include stdbool.htypedef int STDataType; typedef struct Stack {STDataType* a;int top;int capacity; }ST;void STInit(ST* pst); void STDestroy(ST* pst); void STPush(ST* pst, STDataType x); void STPop(ST* pst); STDataType STTop(ST* pst); bool STEmpty(ST* pst); int STSize(ST* pst);void STInit(ST* pst) {assert(pst);pst-a NULL;pst-top 0; //指向栈顶元素的下一个位置pst-capacity 0; }void STDestroy(ST* pst) {assert(pst);free(pst-a);pst-a NULL;pst-top 0;pst-capacity 0; }void STPush(ST* pst, STDataType x) {if (pst-top pst-capacity){int newcapacity pst-capacity 0 ? 4 : pst-capacity * 2;STDataType* tmp (STDataType*)realloc(pst-a, newcapacity * sizeof(STDataType));if (tmp NULL){perror(realloc fail);return;}pst-a tmp;pst-capacity newcapacity;}pst-a[pst-top] x;pst-top; }void STPop(ST* pst) {assert(pst);assert(!STEmpty(pst));pst-top--; }STDataType STTop(ST* pst) {assert(pst);assert(!STEmpty(pst));return pst-a[pst-top - 1]; }bool STEmpty(ST* pst) {assert(pst);return pst-top 0; }int STSize(ST* pst) {assert(pst);return pst-top; }typedef struct {ST pushst;ST popst; } MyQueue;MyQueue* myQueueCreate() {MyQueue* obj (MyQueue*)malloc(sizeof(MyQueue));STInit(obj-pushst);STInit(obj-popst);return obj; }void myQueuePush(MyQueue* obj, int x) {STPush(obj-pushst,x); }int myQueuePeek(MyQueue* obj) {if(STEmpty(obj-popst)){while(!STEmpty(obj-pushst)){STPush(obj-popst,STTop(obj-pushst));STPop(obj-pushst);}}return STTop(obj-popst); }int myQueuePop(MyQueue* obj) {int front myQueuePeek(obj);STPop(obj-popst);return front; }bool myQueueEmpty(MyQueue* obj) {return STEmpty(obj-pushst) STEmpty(obj-popst); }void myQueueFree(MyQueue* obj) {STDestroy(obj-pushst);STDestroy(obj-popst);free(obj); }
http://www.dnsts.com.cn/news/70816.html

相关文章:

  • 杭州做网站的网络公司有哪些荥阳网页设计
  • 怎样做卡盟网站株洲网站建设
  • 网站开发更新记录建设银行网站进不去
  • 做网站什么用武宁县建设工程招标公告门户网站
  • 宠物网站建设总结网络规划设计师视频百度网盘
  • 河南省住房和建设厅网站首页wordpress 改登录界面
  • 可以加外链的网站所有外包网站
  • 27岁了想学网站建设wordpress 如何获得数据库数据
  • 青岛建站模板制作网站建设知识点有哪些漏缺
  • 应用软件开发需要学什么网页设计优化网站建设可以吗
  • 亦庄网站建设价格深圳百度推广电话
  • 网站建设应该考虑哪些问题中资建筑信息平台
  • 在线flash相册网站源码郯城县住房和城乡建设局网站
  • wordpress建站 客户端国外网页素材网站
  • 怎样做好网站用户体验家居企业网站建设策划
  • 哈尔滨网站优化推广公司经典广告
  • 做旅游视频网站wordpress htaccess文件
  • 做网站的zk啥中企动力科技股份有限公司深圳分公司
  • 珠海网站设计价格印度做网站
  • 网站页面高度网站前端设计培训
  • 轻量应用服务器搭建网站wordpress制作网站教程
  • 怎么样在百度做网站app开发和网站开发哪个简单
  • 有专门做消除网站上对公司不利的网站中英文切换怎么做
  • 虚拟网站建设指导Wordpress会员插件出错
  • 外贸soho网站室内设计多久能学出来
  • 手机端公司网站怎么做营销型网站北京
  • 市政道路毕业设计代做网站网站建设外包必须注意几点
  • 网站是做推广好还是优化好做家装模型的效果图网站
  • 做外贸的都有那些网站网站 二级域名
  • 网站数据丢失怎么办手工制作大全女生的最爱