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

互联网网站定位网站建设竣工验收报告

互联网网站定位,网站建设竣工验收报告,绿色食品网站建设可行性,做网站购买备案域名目录 题外话 顺序表和链表优缺点以及特点 一.栈的特点 二. 栈的操作 2.1初始化 2.2 栈的销毁 2.3 栈的插入 2.3 输出top 2.4 栈的删除 2.5 输出栈 题外话 顺序表和链表优缺点以及特点 特点#xff1a;顺序表#xff0c;逻辑地址物理地址。可以任意访问#xff0c…目录 题外话 顺序表和链表优缺点以及特点 一.栈的特点 二. 栈的操作 2.1初始化  2.2 栈的销毁 2.3 栈的插入 2.3 输出top 2.4 栈的删除 2.5 输出栈 题外话 顺序表和链表优缺点以及特点 特点顺序表逻辑地址物理地址。可以任意访问访问时间复杂度O1.。实现分配空                         间当空间不足时要动态扩容。顺序表在销毁时可以直接free但链表要一                         个个删 除。            链表不连续的空间靠指针指向下一个地址。不用实现分配空间。 优缺点             顺序表适和访问不适合插入删除时间负责度为ON。链表适和插入删除操                           作。 一.栈的特点 1先进后出 2栈不能任意打印栈只能访问栈顶 3栈只能尾插头删 二. 栈的操作 2.1初始化  void STInit(ST* pst) {assert(pst);pst-a NULL;pst-top -1;pst-capacity 0; } 2.2 栈的销毁 2.3 栈的插入 注意 如果你初始化为0那么就是先插入在 如果你初始化为-1那就是先在插入。 } //插入 void STPush(ST* pst, STDataType x) {assert(pst);if (pst-top pst-capacity-1){int newcapacity pst-capacity 0 ? 4 : pst-capacity * 2;STDataType* tmp (STDataType*)realloc(pst-a, sizeof(STDataType) * newcapacity);if (tmp NULL) {perror(realloc fail);return;}pst-a tmp;pst-capacity newcapacity;}pst-top;pst-a[pst-top] x; } 2.3 输出top 注意 由于栈的特性只能先进先出尾插头删不能任意输出所以我们只能输出头。 void STTop(ST* pst) {assert(pst);assert(pst-top -1);return pst-a[pst-top]; } 2.4 栈的删除 //删除 void STPop(ST* pst) {assert(pst);assert(pst-top-1);pst-top--;2.5 输出栈 while (STEmpty(st) ! true) {printf(%d , STTop(st));STPop(st); } 栈的完整代码 #pragma once #includestdio.h #includeassert.h #includestdlib.h #includestdbool.htypedef int STDataType; typedef struct STack {STDataType* a; //数值的指针是下标int top;int capacity; }ST;void STInit(ST* pst); void STDestory(ST* pst); void STPush(ST* pst, STDataType x); void STPop(ST* pst); bool STEmpty(ST* pst); int STSize(ST* pst); STDataType STTop(ST* pst);#includeStack.h #includeassert.h #includestdio.h #includestdlib.hvoid STInit(ST* pst) {assert(pst);pst-a NULL;pst-top -1;pst-capacity 0; } void STDestory(ST* pst) {assert(pst);free(pst-a);pst-a NULL;pst-top -1;pst-capacity 0;} //插入 void STPush(ST* pst, STDataType x) {assert(pst);if (pst-top pst-capacity-1){int newcapacity pst-capacity 0 ? 4 : pst-capacity * 2;STDataType* tmp (STDataType*)realloc(pst-a, sizeof(STDataType) * newcapacity);if (tmp NULL) {perror(realloc fail);return;}pst-a tmp;pst-capacity newcapacity;}pst-top;pst-a[pst-top] x; } //输出头结点 STDataType STTop(ST* pst) {assert(pst);assert(pst-top -1);return pst-a[pst-top]; } //删除 void STPop(ST* pst) {assert(pst);assert(pst-top-1);pst-top--; } bool STEmpty(ST* pst) {assert(pst);if (pst-top -1) {return true;}else {return false;} } int STSize(ST* pst) {assert(pst);return pst-top; }#define _CRT_SECURE_NO_WARNINGS #includestdio.h #includestdlib.h #includeStack.hvoid Test1() {ST st;STInit(st);STPush(st, 1);STPush(st, 2);STPush(st, 3);STPush(st, 4);printf(%d\n, STTop(st));STPop(st);printf(%d\n, STTop(st));while (STEmpty(st) ! true) {printf(%d , STTop(st));STPop(st);}}int main() {Test1();return 0; }
http://www.hkea.cn/news/14393003/

相关文章:

  • wordpress建站视频教程下载整合营销传播最基础的形式是
  • 站长之家域名查询官网军事网站 模板
  • 怎么看一个网站用什么平台做的网站建设词语
  • 上海如何做网站用dw制作网站模板下载地址
  • 旅游网站的规划与建设开题报告哪里找做网站的公司
  • 做seo用什么网站系统找施工队伍去什么网站
  • 网站百度收录变少网站推广经理招聘
  • 青岛高端网站开发sem外包
  • 如何做行业网站价格低是什么意思
  • 网站建设项目实训报告站长工具查询ip地址
  • 网站 域名 云服务器网站建设属于什么经营范围
  • 给企业做网站的平台哪家开发app公司好
  • 科技尽头seo sem是做什么的
  • 提供网站哪家好广告设计培训课程
  • 网站后台编辑框不显示门户网站如何帮企业做宣传
  • 站长统计app进入网址柳市做网站的公司
  • cms建站系统安装整站seo优化哪家好
  • 浩博建设集团网站flash 的网站
  • 优秀企业网站建设价格考互联网营销师证书要多少钱
  • 网站 推广商系统 设计南阳网站建站公司
  • 跨境电商网站搭建建一个网站一般要多少钱
  • 汕头网站建设托管ss和wordpress
  • 怎么做提高网站排名大型的平台类网站建设需要多少资金
  • 营销型网站制作公司wordpress建的网站如何跟微信集成
  • 长春网站营销wordpress国内访问不了
  • 网站建设昆山花桥东丽区 网站建设
  • asp化妆品网站源码适配网站建设模版
  • 学校网站的建设费用吗wordpress删除不了插件
  • 陕西省住房和城乡建设厅网站上查询百度seo算法
  • 建网站能赚钱吗赚多少知乎网页版