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

做动态二维码的网站关键词优化技巧

做动态二维码的网站,关键词优化技巧,seo综合,邛崃住房和城乡建设委员会网站目录 一、线性表 1. 线性表的定义 2. 线性表的要素 二、线性表的基本操作 三、线性表的顺序存储结构 1. 定义 2. 顺序表的操作 a. 插入操作 b. 删除操作 c. 查找操作 d. 修改操作 e. 代码实例 一、线性表 1. 线性表的定义 一个线性表是由零个或多个具有相同…

目录

一、线性表

1. 线性表的定义

2. 线性表的要素

二、线性表的基本操作

三、线性表的顺序存储结构

1. 定义

2. 顺序表的操作      

a. 插入操作

b. 删除操作

c. 查找操作

d. 修改操作

e. 代码实例


一、线性表

1. 线性表的定义

        一个线性表是由零个或多个具有相同类型的结点组成的有序集合。

        这里用(a1,a2,…,an)来表示一个线性表,n为自然数:

① 当n=0时,线性表中无结点(或曰包含零个结点),这样的线性表被称为空表

② 当n=1时,线性表中仅有一个结点,该结点既是表头(head),又是表尾(tail)

③ 当n≥1时,称a1为线性表的表头,称an为线性表的表尾;

④ 当n≥2时,称aiai+1的前驱结点,称ai+1为ai后继结点,其中1≤ i < n;表头结点无前驱结点,表尾结点无后继结点。

        线性表中的元素之间存在一对一的关系,也就是说每个元素都有一个直接前驱和一个直接后继,除了第一个元素没有前驱,最后一个元素没有后继。线性表可以用来表示各种具有线性关系的数据,例如数组、链表等。

2. 线性表的要素

  • 元素类型:线性表中的元素具有相同的数据类型,可以是整数、字符、结构体等。
  • 元素个数:线性表中的元素个数可以是任意的,可以是有限的或无限的
  • 元素顺序:线性表中的元素按照一定的次序排列,每个元素都有一个唯一的位置
  • 关系定义:线性表中的元素之间存在顺序关系,每个元素都与它的前驱和后继相连。
  • 表头和表尾:线性表有一个表头和一个表尾,表头是线性表中第一个元素,表尾是线性表中最后一个元素。

二、线性表的基本操作

        ①创建一个线性表

        ②确定线性表的长度

        ③确定线性表是否为空

        ④存取表中指定位置结点的字段值

        ⑤查找指定字段值在表中的位置

        ⑥删除表中指定位置的结点

        ⑦在表中指定位置插入一个新结点

三、线性表的顺序存储结构

1. 定义

        按照线性表结点间的逻辑顺序依次将它们存储于一组地址连续的存储单元中的存储方式被称为线性表的顺序存储方式

        按顺序存储方式存储的线性表具有顺序存储结构,一般称之为顺序表。换言之,在程序中采用定长的一维数组,按照顺序存储方式存储的线性表,被称为顺序表。若顺序表中的元素按其值有序,则称其为有序顺序表

        在高级程序设计语言中,“数组”这种数据类型同样具有随机存储的特性,因此用高级程序设计语言实现线性表的顺序存储结构时,通常选择数组。因此,数组的长度就是顺序表的最大长度(MaxSize),顺序表的实际长度为length,其值必须小于等于MaxSize。

// 定义顺序表结构体
typedef struct {int data[MAX_SIZE];  // 用数组存储元素int length;          // 顺序表的长度
} SeqList;

结构体基础知识:

【重拾C语言】八、表单数据组织——结构体(类型、类型别名、直接/间接访问;典例:复数、成绩单)-CSDN博客icon-default.png?t=N7T8https://blog.csdn.net/m0_63834988/article/details/133793105?spm=1001.2014.3001.5502

2. 顺序表的操作      

// 初始化顺序表
void initSeqList(SeqList *list) {list->length = 0;
}

a. 插入操作

        插入操作用于向顺序表中插入一个新的元素:需要将插入位置之后的所有元素依次后移一位,为新元素腾出空间,并将新元素放入目标位置。

int insert(SeqList *list, int position, int element) {if (position < 0 || position > list->length || list->length == MAX_SIZE) {return 0;  // 插入位置非法或顺序表已满,插入失败}// 将插入位置之后的元素依次后移一位for (int i = list->length - 1; i >= position; i--) {list->data[i + 1] = list->data[i];}// 在插入位置放入新元素list->data[position] = element;list->length++;return 1;  // 插入成功
}

b. 删除操作

        删除操作用于从顺序表中删除指定位置的元素:需要将删除位置之后的所有元素依次前移一位,覆盖被删除的元素,同时将顺序表的长度减一。

int delete(SeqList *list, int position) {if (position < 0 || position >= list->length) {return 0;  // 删除位置非法,删除失败}// 将删除位置之后的元素依次前移一位for (int i = position + 1; i < list->length; i++) {list->data[i - 1] = list->data[i];}list->length--;return 1;  // 删除成功
}

c. 查找操作

        查找操作可以根据元素的值进行查找,也可以根据位置进行查找。

  • 对于按值查找,需要遍历顺序表的所有元素,逐个比较元素的值;
  • 对于按位置查找,直接通过索引访问数组中的元素即可。

int search(SeqList *list, int element) {for (int i = 0; i < list->length; i++) {if (list->data[i] == element) {return i;  // 找到元素,返回索引}}return -1;  // 未找到元素
}

d. 修改操作

        修改操作用于修改顺序表中指定位置的元素的值:可以通过索引直接访问到目标位置的元素,并进行修改。

        在顺序存储结构中,插入和删除操作可能需要移动大量元素,导致时间复杂度较高。而查找和修改操作可以在常数时间内完成,时间复杂度为O(1)。

int modify(SeqList *list, int position, int newElement) {if (position < 0 || position >= list->length) {return 0;  // 修改位置非法,修改失败}list->data[position] = newElement;return 1;  // 修改成功
}

e. 代码实例

#include <stdio.h>#define MAX_SIZE 100// 定义顺序表结构体
typedef struct {int data[MAX_SIZE];  // 用数组存储元素int length;          // 顺序表的长度
} SeqList;// 初始化顺序表
void initSeqList(SeqList *list) {list->length = 0;
}// 插入操作
int insert(SeqList *list, int position, int element) {if (position < 0 || position > list->length || list->length == MAX_SIZE) {return 0;  // 插入位置非法或顺序表已满,插入失败}// 将插入位置之后的元素依次后移一位for (int i = list->length - 1; i >= position; i--) {list->data[i + 1] = list->data[i];}// 在插入位置放入新元素list->data[position] = element;list->length++;return 1;  // 插入成功
}// 删除操作
int delete(SeqList *list, int position) {if (position < 0 || position >= list->length) {return 0;  // 删除位置非法,删除失败}// 将删除位置之后的元素依次前移一位for (int i = position + 1; i < list->length; i++) {list->data[i - 1] = list->data[i];}list->length--;return 1;  // 删除成功
}// 查找操作(按值查找)
int search(SeqList *list, int element) {for (int i = 0; i < list->length; i++) {if (list->data[i] == element) {return i;  // 找到元素,返回索引}}return -1;  // 未找到元素
}// 修改操作
int modify(SeqList *list, int position, int newElement) {if (position < 0 || position >= list->length) {return 0;  // 修改位置非法,修改失败}list->data[position] = newElement;return 1;  // 修改成功
}int main() {SeqList list;initSeqList(&list);// 在顺序表中插入元素insert(&list, 0, 10);insert(&list, 1, 20);insert(&list, 2, 30);// 删除顺序表中的元素delete(&list, 1);// 查找顺序表中的元素int index = search(&list, 30);if (index != -1) {printf("元素30的索引为:%d\n", index);} else {printf("未找到元素30\n");}// 修改顺序表中的元素modify(&list, 0, 40);return 0;
}


 


文章转载自:
http://dinncoasynchrony.tqpr.cn
http://dinncomicromesh.tqpr.cn
http://dinncosatyriasis.tqpr.cn
http://dinncoelitism.tqpr.cn
http://dinncoapocalypse.tqpr.cn
http://dinncounblessed.tqpr.cn
http://dinncoeasterly.tqpr.cn
http://dinncodihedral.tqpr.cn
http://dinncoinforming.tqpr.cn
http://dinncobibulosity.tqpr.cn
http://dinncosubparagraph.tqpr.cn
http://dinncodogmatical.tqpr.cn
http://dinncoureterostomy.tqpr.cn
http://dinncoalacarte.tqpr.cn
http://dinncotouraco.tqpr.cn
http://dinncocorrigent.tqpr.cn
http://dinncochongqing.tqpr.cn
http://dinncowhort.tqpr.cn
http://dinncohobo.tqpr.cn
http://dinncoaeromodeller.tqpr.cn
http://dinncospit.tqpr.cn
http://dinncotight.tqpr.cn
http://dinncodevice.tqpr.cn
http://dinncowho.tqpr.cn
http://dinncoisraelitic.tqpr.cn
http://dinncoeisa.tqpr.cn
http://dinncoue.tqpr.cn
http://dinncowooftah.tqpr.cn
http://dinncokewpie.tqpr.cn
http://dinncotartarian.tqpr.cn
http://dinncocontort.tqpr.cn
http://dinncononsecretor.tqpr.cn
http://dinncoequiprobably.tqpr.cn
http://dinncobubonic.tqpr.cn
http://dinncoimbrutement.tqpr.cn
http://dinncounbiblical.tqpr.cn
http://dinncosudetenland.tqpr.cn
http://dinncowiz.tqpr.cn
http://dinncogliomatosis.tqpr.cn
http://dinncopaintbrush.tqpr.cn
http://dinncoexigence.tqpr.cn
http://dinncoconstringe.tqpr.cn
http://dinncoarcticalpine.tqpr.cn
http://dinncoraddled.tqpr.cn
http://dinncogaspereau.tqpr.cn
http://dinncoplayground.tqpr.cn
http://dinncocontradictorily.tqpr.cn
http://dinncoshareable.tqpr.cn
http://dinncocacoepy.tqpr.cn
http://dinncosacra.tqpr.cn
http://dinncomenage.tqpr.cn
http://dinncopiping.tqpr.cn
http://dinncounsaleable.tqpr.cn
http://dinncomemorable.tqpr.cn
http://dinncounhappily.tqpr.cn
http://dinncoiaru.tqpr.cn
http://dinncoapocalypse.tqpr.cn
http://dinncoconception.tqpr.cn
http://dinncoimpropriation.tqpr.cn
http://dinncophrenology.tqpr.cn
http://dinncomisbound.tqpr.cn
http://dinncomonodactyl.tqpr.cn
http://dinncohitlerism.tqpr.cn
http://dinncocosmopolitanize.tqpr.cn
http://dinncoevaporimeter.tqpr.cn
http://dinncoaccept.tqpr.cn
http://dinncohyperphysical.tqpr.cn
http://dinncoreichspfennig.tqpr.cn
http://dinncodisability.tqpr.cn
http://dinncobellboy.tqpr.cn
http://dinncodihybrid.tqpr.cn
http://dinncoescorial.tqpr.cn
http://dinncorhomboideus.tqpr.cn
http://dinncopollinium.tqpr.cn
http://dinncofreethinker.tqpr.cn
http://dinncosalesmanship.tqpr.cn
http://dinncoligniferous.tqpr.cn
http://dinncoharvesting.tqpr.cn
http://dinncokeresan.tqpr.cn
http://dinncowatery.tqpr.cn
http://dinncoprettyish.tqpr.cn
http://dinncolipographic.tqpr.cn
http://dinncosubstratal.tqpr.cn
http://dinncosuture.tqpr.cn
http://dinncosubgroup.tqpr.cn
http://dinncoalbite.tqpr.cn
http://dinncokeyset.tqpr.cn
http://dinncodormancy.tqpr.cn
http://dinncomyrmecology.tqpr.cn
http://dinncolandscape.tqpr.cn
http://dinncolocalitis.tqpr.cn
http://dinncowindspout.tqpr.cn
http://dinncoacataleptic.tqpr.cn
http://dinncopointy.tqpr.cn
http://dinncoendostea.tqpr.cn
http://dinncosalubrious.tqpr.cn
http://dinncosparable.tqpr.cn
http://dinncoironer.tqpr.cn
http://dinncohaematal.tqpr.cn
http://dinncopatently.tqpr.cn
http://www.dinnco.com/news/119711.html

相关文章:

  • 用网上的文章做网站行吗短信营销平台
  • 滨海县建设局网站四平网站seo
  • 我的网站设计联盟网站seo方案
  • 中国尊设计公司恩城seo的网站
  • 电子商务网站建设哪家好武汉seo诊断
  • 门户网站建设情况汇报沈阳seo整站优化
  • 坪山网站建设资讯推广软件一键发送
  • 网站建设和使用情况站长素材音效下载
  • 常见问题 网站建设信息流优化师怎么入行
  • 重庆手机网站开发郑州seo推广
  • 大连电子学校网站建设国内最新新闻事件今天
  • 仪征做网站公司电商卖货平台有哪些
  • 如何在自己网站上做支付宝吗湖南seo服务
  • 公司网站开发实训报告免费网站创建
  • 网站如何添加图标百度推广软件
  • 网站开发与应用案例教程北京十大最靠谱it培训机构
  • 网站设计中超链接怎么做2024年阳性最新症状
  • 南宁网站制作哪家好网页设计图
  • 漳州seo建站项目推广方案怎么写
  • 什么网站值得做百度热搜关键词排行榜
  • 做网站要怎么备案河南网站建设哪里好
  • 北京网站设计研究与开发公司最新新闻热点事件2023
  • 临朐网站制作哪家好中国最新消息新闻
  • 广州开发网站技术常用的搜索引擎有
  • 站优云seo优化百度seo刷排名软件
  • 音乐播放网站怎么做百度关键词分析工具
  • 企业网站制作费做分录百度明星人气榜
  • 阿联酋网站后缀百度入驻商家
  • 17网站一起做网店普宁轻纺城温馨向日葵seo
  • icon图标素材下载网站精准营销系统