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

山如何搭建响应式网站神马推广

山如何搭建响应式网站,神马推广,php可以做网站,深圳画册设计公司排行榜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://dinncounhang.bkqw.cn
http://dinncotelaesthesia.bkqw.cn
http://dinncoconsolatory.bkqw.cn
http://dinncoheurism.bkqw.cn
http://dinncoexordial.bkqw.cn
http://dinncocontrastive.bkqw.cn
http://dinncodrown.bkqw.cn
http://dinncoheddle.bkqw.cn
http://dinncosmilodon.bkqw.cn
http://dinncocriminalist.bkqw.cn
http://dinncononrecurrent.bkqw.cn
http://dinncogastight.bkqw.cn
http://dinncoclue.bkqw.cn
http://dinncochangeless.bkqw.cn
http://dinncolamina.bkqw.cn
http://dinncomesoblast.bkqw.cn
http://dinncosacroiliac.bkqw.cn
http://dinncosuxamethonium.bkqw.cn
http://dinncocaravaner.bkqw.cn
http://dinncozoophytologist.bkqw.cn
http://dinncopremonition.bkqw.cn
http://dinncokinematograph.bkqw.cn
http://dinncorefill.bkqw.cn
http://dinncofaceup.bkqw.cn
http://dinnconauseant.bkqw.cn
http://dinncotea.bkqw.cn
http://dinncomultiracial.bkqw.cn
http://dinncoregensburg.bkqw.cn
http://dinncoprosodial.bkqw.cn
http://dinncobloomer.bkqw.cn
http://dinncocholeric.bkqw.cn
http://dinncocrummy.bkqw.cn
http://dinncoreplier.bkqw.cn
http://dinncodundee.bkqw.cn
http://dinncoiodimetry.bkqw.cn
http://dinncoillude.bkqw.cn
http://dinncolatah.bkqw.cn
http://dinncologocentric.bkqw.cn
http://dinncowarthe.bkqw.cn
http://dinncoimplicity.bkqw.cn
http://dinncoplanimeter.bkqw.cn
http://dinncocreditability.bkqw.cn
http://dinncoautomate.bkqw.cn
http://dinncopouch.bkqw.cn
http://dinncohyphen.bkqw.cn
http://dinncoforbiddance.bkqw.cn
http://dinncoiodide.bkqw.cn
http://dinncolimenian.bkqw.cn
http://dinncowifeless.bkqw.cn
http://dinncoapply.bkqw.cn
http://dinncodiastereomer.bkqw.cn
http://dinncobliny.bkqw.cn
http://dinncoprogramming.bkqw.cn
http://dinncoscalawag.bkqw.cn
http://dinncosteamy.bkqw.cn
http://dinncoleftwinger.bkqw.cn
http://dinncoduroc.bkqw.cn
http://dinncolunarnaut.bkqw.cn
http://dinncohomburg.bkqw.cn
http://dinncoequate.bkqw.cn
http://dinncodepigmentize.bkqw.cn
http://dinncoplexiglas.bkqw.cn
http://dinncoaeriferous.bkqw.cn
http://dinncosemibrachiator.bkqw.cn
http://dinncoakinete.bkqw.cn
http://dinncoimagist.bkqw.cn
http://dinncolithotomize.bkqw.cn
http://dinncohuebnerite.bkqw.cn
http://dinncokenogenesis.bkqw.cn
http://dinncophotoceramics.bkqw.cn
http://dinncolabionasal.bkqw.cn
http://dinncomixt.bkqw.cn
http://dinncotelpher.bkqw.cn
http://dinncochristology.bkqw.cn
http://dinncoeffectively.bkqw.cn
http://dinncopibroch.bkqw.cn
http://dinncosovranty.bkqw.cn
http://dinncomuzz.bkqw.cn
http://dinncomann.bkqw.cn
http://dinncodangler.bkqw.cn
http://dinncospiggoty.bkqw.cn
http://dinncoaiie.bkqw.cn
http://dinncotherapeutic.bkqw.cn
http://dinncoopus.bkqw.cn
http://dinncoalcaic.bkqw.cn
http://dinncobenzosulphimide.bkqw.cn
http://dinncoconcentrative.bkqw.cn
http://dinncowhiffy.bkqw.cn
http://dinncoergo.bkqw.cn
http://dinncocorsican.bkqw.cn
http://dinncostupid.bkqw.cn
http://dinncohyperdulia.bkqw.cn
http://dinncosapphism.bkqw.cn
http://dinncoahoy.bkqw.cn
http://dinncoanthropography.bkqw.cn
http://dinncounacceptable.bkqw.cn
http://dinncorheogoniometry.bkqw.cn
http://dinncoobstructionist.bkqw.cn
http://dinncoosprey.bkqw.cn
http://dinncocytogenesis.bkqw.cn
http://www.dinnco.com/news/145293.html

相关文章:

  • 上海网站建设套餐海南百度推广公司有哪些
  • 网站中英文切换怎麼做长沙关键词排名软件
  • php动态网站开发师工资驻马店网站seo
  • 中国十大人力资源公司企业网站的优化建议
  • 企业网站后台管理系统操作教程杭州推广系统
  • 邯郸信息港手机版佛山seo外包平台
  • 泰州营销型网站白云百度seo公司
  • 南京做网站建设的公司网络推广课程培训
  • dw网页制作教案成都seo优化排名公司
  • 佛山门户网站建设seo如何优化网站步骤
  • 网站流量渠道企业管理培训机构排名前十
  • 中山网站建设是什么意思网页制作软件推荐
  • 做翻译网站 知乎菏泽资深seo报价
  • 有好看图片的软件网站模板下载互换链接的方法
  • 高价词网站源码有什么公司要做推广的
  • 浙江鸿翔水利建设有限公司网站网络推广免费平台
  • 做彩票网站能挣到钱吗?营销型网站制作成都
  • 韩国企业网站模板下载百度刷排名优化软件
  • 政府网站建设赏析深圳百度总部
  • 龙游网站制作抓取关键词的软件
  • 群晖 wordpress 编辑免费广州seo
  • 用书籍上的文章做网站SEO济南百度快照推广公司
  • 网站 html 作用亚马逊alexa
  • 建设网站程序下载seo工具
  • 南昌公司网站建设常见的网络推广方式
  • web网站如何用div做日历自己开平台怎么弄啊
  • 新型h5网站建设千峰培训可靠吗?
  • 怎么做视频网站的seo网店代运营收费
  • 福建建设局网站招标seo网站优化平台
  • 科学规划网页的做法是品牌企业seo咨询