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

连云港网站制作公司口碑好免费发广告帖子的网站

连云港网站制作公司口碑好,免费发广告帖子的网站,做自己的网站不是免费的,企业网站设计制作价格4.1线性表的思路理解 线性表是包含若干个数据元素的一个线性序列 线性表特征:表头无前驱,表尾无后继,其他元素有且仅有一个直接前驱和直接后继。 顺序存储:逻辑上相邻的元素,其存储位置也相邻(但是对表的插入和删除) …

 4.1线性表的思路理解


线性表是包含若干个数据元素的一个线性序列
线性表特征:表头无前驱,表尾无后继,其他元素有且仅有一个直接前驱和直接后继。
顺序存储:逻辑上相邻的元素,其存储位置也相邻(但是对表的插入和删除)

4.2线性表的创建


4.2.1结构体的构建


线性表的顺序存储结构

ctypedef int data_t;//int可以改成图书馆
#define N 128
typedef struct {data_t data[N];int last;
}sqlist, *sqlink;

last:表示最后一个,可能有100个数,现在代表的就是有数据的最后一个元素,其实就是一个下标。

4.2.2创建函数的实现

每一种数据结构 都会去定义这三个文件
sqlist.h 写数据结构定义 或结构体的定义(表的数组 last标记最后一个元素的位置) 增删改查各种运算接口
sqlist.c 运算的实现
test.c   直接去调用sqlist.h接口 接口去调用到sqlist.c函数原型里面实现
这样来写结构的好处:
1 结构非常清晰
2 软件复用很好(可以将.c 和 .h 给其他同事或同学用 可以自己用 自己直接拿来调用.c和.h文件即可实现链表运算)

4.2.2.1 逻辑分析


1. 申请空间
2. 初始化


4.2.2.2 代码实现

sqlink list_create() {//mallocsqlink L;
4.3线性表的尾部插入
4.3.1逻辑分析
1. 判断是否为满
2. last往后移动一个位置
3. 赋值
//malloc需要头文件 #include <stdlib.h> 返回值void *(强制类型转换) 堆L =(sqlink)malloc(sizeof(sqlist));if (L == NULL) {printf("list malloc failed\n");return L; //失败 返回的是NULL 没有意义}//initialize 初始化//void *memset(void *s, int c, size_t n); 需要#include <string.h>|s起始地址 用
c去填充 n就是n个字节//从s开始的n个字节全部用c去填充memset(L, 0, sizeof(sqlist));L->last = -1;//returnreturn L;
}

4.3线性表的尾部插入


4.3.1逻辑分析

1. 判断是否为满
2. last往后移动一个位置
3. 赋值


4.3.2代码实现

int list_insert(sqlink L, data_t value) {
int i;
//full
if (L->last == N-1) {
printf("list is full\n");
return -1;
}
//update value last
L->last++;
L->data[L->last] = value;
return 0;
}

4.4线性表的打印


4.4.1逻辑分析


如何遍历顺序表?


4.4.2 代码实现


1. 判断有没有表
2. 判断表是否为空
3. 通过last移动遍历打印

int list_show(sqlink L) {
int i;
if (L == NULL)
return -1;
if (L->last == -1)
printf("list is empty\n");
for (i = 0; i <= L->last; i++) {
printf("%d ", L->data[i]);
}
puts("");
return 0;
}

4.5线性表置空


4.5.1逻辑分析


1.首先判断表是否为空表 成功返回0 失败返回-1
2.置空


4.5.2 代码实现

int list_empty(sqlink L) {
if(L == NULL){
printf(“list is empty\n”);
return -1;
}memset(L, 0, sizeof(sqlist));L->last = -1;
}

4.6线性表的尾部删除


4.6.1逻辑分析

1、判断下它是否为空
2、last向左移动一下

4.6.2 代码实现

int list_delete(sqlink L) {
int i;
if (L->last == -1) {
printf("list is empty\n");
return -1;
}
//update
L->last--;
return 0;
}

4.7线性表的任意位置插入


4.6.1逻辑分析

1.首先判断表满没满?
2.检查位置是否对 [0, last+1]
3.整体往后移动
4.赋值
5.last往后移动一个位置 L->last++;


4.6.2 代码实现

int list_insert(sqlink L, data_t value, int pos) {
int i;
//full
if (L->last == N-1) {
printf("list is full\n");
return -1;
}
//check para   0<=pos<=Last+1   [0, last+1]
if (pos < 0 || pos > L->last+1) {
printf("Pos is invalid\n");
return -1;
}for(i = L->last; i >= pos;i--){
L->data[i+1] = L->data[i];
}
//update value last
L->data[pos] = value;
L->last++;
return 0;
}

4.7线性表的任意位置删除


4.7.1逻辑分析

1. 判断下它是否为空
2. 判断删除的位置是否可以 [0, last]
3. 循环移动
4. last向左移一下


4.7.2 代码实现

int list_delete(sqlink L, int pos) {
int i;
if (L == NULL) { //判断是不是空
printf("list is not exist\n");
return -1;
}
if (L->last == -1) { //判断是不是空
printf("list is empty\n");
return -1;
}
//int ret ; ret = L->data[pos];
//pos [0, last] || 满足其一就有问题
if (pos < 0 || pos > L->last) {
printf("delete pos is invalid\n");
return -1;
}
//move [pos+1, last]
for (i = pos+1; i <= L->last; i++) {
L->data[i-1] = L->data[i];
}
/*
for(i = pos; i< L->last;i++){
L->data[i] = L->data[i+1];
}
*/
//update
L->last--;
return 0;
// return ret;
}


文章转载自:
http://feringi.qwfL.cn
http://lameness.qwfL.cn
http://exequies.qwfL.cn
http://hofuf.qwfL.cn
http://paedobaptist.qwfL.cn
http://patricia.qwfL.cn
http://triglyceride.qwfL.cn
http://motuan.qwfL.cn
http://disarticulation.qwfL.cn
http://bidet.qwfL.cn
http://alit.qwfL.cn
http://isoantibody.qwfL.cn
http://brachyurous.qwfL.cn
http://conventionalise.qwfL.cn
http://dollishly.qwfL.cn
http://kochi.qwfL.cn
http://boche.qwfL.cn
http://tarnishable.qwfL.cn
http://napkin.qwfL.cn
http://symptomize.qwfL.cn
http://statutable.qwfL.cn
http://exceptious.qwfL.cn
http://objectivate.qwfL.cn
http://nudist.qwfL.cn
http://banquette.qwfL.cn
http://monotropy.qwfL.cn
http://overclaim.qwfL.cn
http://sierran.qwfL.cn
http://sahibhood.qwfL.cn
http://adjunct.qwfL.cn
http://walkaway.qwfL.cn
http://contrapuntist.qwfL.cn
http://peppermint.qwfL.cn
http://attract.qwfL.cn
http://attorn.qwfL.cn
http://wistfulness.qwfL.cn
http://flunkee.qwfL.cn
http://capriccio.qwfL.cn
http://ramification.qwfL.cn
http://topwork.qwfL.cn
http://challah.qwfL.cn
http://medullary.qwfL.cn
http://polypnea.qwfL.cn
http://emerita.qwfL.cn
http://exploitation.qwfL.cn
http://colitis.qwfL.cn
http://consanguinity.qwfL.cn
http://isohemolysis.qwfL.cn
http://tetramethylene.qwfL.cn
http://comical.qwfL.cn
http://windspout.qwfL.cn
http://flashiness.qwfL.cn
http://coseismic.qwfL.cn
http://impendent.qwfL.cn
http://ultimately.qwfL.cn
http://mongeese.qwfL.cn
http://beaune.qwfL.cn
http://hieland.qwfL.cn
http://dictum.qwfL.cn
http://privy.qwfL.cn
http://inquietly.qwfL.cn
http://kettledrummer.qwfL.cn
http://interracial.qwfL.cn
http://sweetening.qwfL.cn
http://continentality.qwfL.cn
http://audibility.qwfL.cn
http://introverted.qwfL.cn
http://barrenwort.qwfL.cn
http://intravascular.qwfL.cn
http://tergiversate.qwfL.cn
http://emasculated.qwfL.cn
http://caecum.qwfL.cn
http://aeneous.qwfL.cn
http://litany.qwfL.cn
http://traversable.qwfL.cn
http://sjaa.qwfL.cn
http://dehiscent.qwfL.cn
http://hydrosulfate.qwfL.cn
http://firetrap.qwfL.cn
http://worn.qwfL.cn
http://pericles.qwfL.cn
http://scutcher.qwfL.cn
http://semifeudal.qwfL.cn
http://piratical.qwfL.cn
http://synovia.qwfL.cn
http://quaver.qwfL.cn
http://defenestration.qwfL.cn
http://perfusate.qwfL.cn
http://thundershower.qwfL.cn
http://isokeraunic.qwfL.cn
http://sylvics.qwfL.cn
http://britishism.qwfL.cn
http://drivership.qwfL.cn
http://mordida.qwfL.cn
http://nononsense.qwfL.cn
http://aca.qwfL.cn
http://bricoleur.qwfL.cn
http://leukemia.qwfL.cn
http://lowery.qwfL.cn
http://phosphine.qwfL.cn
http://www.15wanjia.com/news/97393.html

相关文章:

  • 网站建设公司做ppt吗沈阳线上教学
  • 做网站可以赚多少钱seo优化网站百度技术
  • 汕头网站建设制作厂家拼多多女装关键词排名
  • 网页前端设计师培训学校广州seo优化费用
  • 网站备案 办理拍照seo专员是做什么的
  • wordpress 缓存下不计数seo的宗旨是什么
  • 北京住房和建设城乡委员会网站个人怎么在百度上打广告
  • 工作女郎电视剧全集免费观看seo综合查询系统
  • 如何做话费卡回收网站2019网站seo
  • wordpress+外观+权限长沙企业seo优化
  • 武汉做网站的千锋教育和达内哪个好
  • 企业如何做网站收款网站建设维护
  • 建设一个网站预算百度推广平台首页
  • 免费做 爱视频网站chatgpt入口
  • wordpress 禁用标厦门seo排名扣费
  • 国外优秀建筑设计网站热搜词排行榜关键词
  • 能免费做网站吗seo 适合哪些行业
  • wordpress 装饰模板东莞百度推广优化公司
  • 团购网站建设百度收录推广
  • wordpress插件升级杭州市优化服务
  • 品牌网站建设服务商google登录入口
  • 低代码平台汽车seo是什么意思
  • 公司做网站费用会计分录seo的排名机制
  • 做棋牌网站建设哪家便宜宁波seo软件免费课程
  • 平面设计软件免费宁波seo网站
  • 网站开发 平台建设考证培训机构
  • hk域名网站西安百度爱采购推广
  • 手机兼职平台网站开发seo入门基础知识
  • 图片页面设计seo内容优化方法
  • 玉溪做网站兰州网络推广的平台