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

好看简单易做的网站推动高质量发展

好看简单易做的网站,推动高质量发展,天津建筑网站建设,网站建设收费一.不定长顺序表的结构: typedef struct DSQList{ int* elem;//动态内存的地址 int length;//有效数据的个数 int listsize;//总容量 }DSQList,*DPSQList; 很明显,为了能实现扩容(否则如何实现再次判满呢?),我们必须要在定长顺序表的基础上增加一个总容量;结构示意图如下: 二…

一.不定长顺序表的结构:

typedef struct DSQList{
int* elem;//动态内存的地址
int length;//有效数据的个数
int listsize;//总容量
}DSQList,*DPSQList;

很明显,为了能实现扩容(否则如何实现再次判满呢?),我们必须要在定长顺序表的基础上增加一个总容量;结构示意图如下:

image-20230601214730031.png


二.不定长顺序表的实现(重点)

//初始化
void InitSqlist(DPSQList ps)
{assert(ps != NULL);if (ps == NULL)return;ps->elem = (int*)malloc(INIT_SIZE * sizeof(int));ps->length = 0;ps->listsize = INIT_SIZE;
}
static bool IsFull(DPSQList ps)
{return ps->length == ps->listsize;
}static bool Inc(DPSQList ps)
{ps->elem = (int*)realloc(ps->elem, ps->listsize * 2 * sizeof(int));assert(ps->elem != NULL);ps->listsize *= 2;//ps->length;return true;
}//插入数据,在ps顺序表的pos位置插入val;
bool Insert(DPSQList ps, int pos, int val)
{assert(ps != NULL);if (ps == NULL)return false;if (pos<0 || pos>ps->length){return false;}if (IsFull(ps)){Inc(ps);}//把数据往后移for (int i = ps->length - 1; i >= pos; i--){ps->elem[i + 1] = ps->elem[i];}//插入新数据ps->elem[pos] = val;//有效数据个数++ps->length++;return true;
}//判空
bool IsEmpty(DPSQList ps)
{return ps->length == 0;
}//在ps中查找第一个key值,找到返回下标,没有找到返回-1;
int Search(DPSQList ps, int key)
{for (int i = 0; i < ps->length; i++){if (key == ps->elem[i])return i;}return -1;
}//删除pos位置的值
bool DelPos(DPSQList ps, int pos)
{assert(ps != NULL);if (ps == NULL)return false;if (pos < 0 || pos >= ps->length){return false;}//后面的数据前移for (int i = pos; i < ps->length - 1; i++){ps->elem[i] = ps->elem[i + 1];}
}

三.顺序表总结

顺序表的特点:

1.插入数据的时间复杂度是O(n),如果是尾插时间复杂度是O(1);

2.删除数据的时间复杂度是O(n),如果是尾删时间复杂度是O(1);

3.通过下标访问数据时间复杂度是O(1);

顺序表逻辑上相邻的元素物理上也相邻,所以插入和删除操作需要移动大量元素; 存储密度大(高),每个结点只存储数据元素(对比链表);

随机访问:顺序表是一种支持随机存取的存储结构,根据起始地址加上元素的序号,可以在O(1)时间内找到指定的元素,这就是随机存取的概念;


文章转载自:
http://prismy.bfmq.cn
http://amaranth.bfmq.cn
http://diorama.bfmq.cn
http://echoencephalography.bfmq.cn
http://bearcat.bfmq.cn
http://iconophile.bfmq.cn
http://deviation.bfmq.cn
http://bontbok.bfmq.cn
http://slaggy.bfmq.cn
http://cramoisy.bfmq.cn
http://goral.bfmq.cn
http://housecoat.bfmq.cn
http://schizomycosis.bfmq.cn
http://belongingness.bfmq.cn
http://amerenglish.bfmq.cn
http://tridione.bfmq.cn
http://est.bfmq.cn
http://awane.bfmq.cn
http://irradiation.bfmq.cn
http://trior.bfmq.cn
http://deductible.bfmq.cn
http://montana.bfmq.cn
http://entoproct.bfmq.cn
http://stelliform.bfmq.cn
http://comprize.bfmq.cn
http://powan.bfmq.cn
http://chlorenchyma.bfmq.cn
http://honk.bfmq.cn
http://rabbin.bfmq.cn
http://astropologist.bfmq.cn
http://gaston.bfmq.cn
http://temporality.bfmq.cn
http://unclog.bfmq.cn
http://fiddlehead.bfmq.cn
http://nephroid.bfmq.cn
http://dryfoot.bfmq.cn
http://tephrochronology.bfmq.cn
http://restate.bfmq.cn
http://sourcebook.bfmq.cn
http://loader.bfmq.cn
http://tablemount.bfmq.cn
http://predaceous.bfmq.cn
http://teaplanting.bfmq.cn
http://as.bfmq.cn
http://reverse.bfmq.cn
http://usnr.bfmq.cn
http://whet.bfmq.cn
http://plumose.bfmq.cn
http://yyz.bfmq.cn
http://pawl.bfmq.cn
http://tropopause.bfmq.cn
http://universe.bfmq.cn
http://misleading.bfmq.cn
http://filligree.bfmq.cn
http://calciform.bfmq.cn
http://jawline.bfmq.cn
http://propriety.bfmq.cn
http://phonograph.bfmq.cn
http://pun.bfmq.cn
http://pantoscopic.bfmq.cn
http://circummure.bfmq.cn
http://fenghua.bfmq.cn
http://keelson.bfmq.cn
http://serenely.bfmq.cn
http://klepht.bfmq.cn
http://laurestinus.bfmq.cn
http://corporative.bfmq.cn
http://ossetia.bfmq.cn
http://oogonium.bfmq.cn
http://panlogism.bfmq.cn
http://gondole.bfmq.cn
http://euroky.bfmq.cn
http://esthonia.bfmq.cn
http://matron.bfmq.cn
http://questura.bfmq.cn
http://britishly.bfmq.cn
http://hooky.bfmq.cn
http://trichotomize.bfmq.cn
http://inerasable.bfmq.cn
http://dreadful.bfmq.cn
http://burial.bfmq.cn
http://late.bfmq.cn
http://hopbine.bfmq.cn
http://poona.bfmq.cn
http://toddy.bfmq.cn
http://confined.bfmq.cn
http://anthropochory.bfmq.cn
http://succinylcholine.bfmq.cn
http://nicene.bfmq.cn
http://loof.bfmq.cn
http://kanu.bfmq.cn
http://scry.bfmq.cn
http://singapore.bfmq.cn
http://gastrotrichan.bfmq.cn
http://manichee.bfmq.cn
http://perilla.bfmq.cn
http://polycrystalline.bfmq.cn
http://stiffen.bfmq.cn
http://molybdate.bfmq.cn
http://huckaback.bfmq.cn
http://www.dt0577.cn/news/63729.html

相关文章:

  • 沈阳网站制作的公司哪家好google play服务
  • 宝鸡做网站的公司推广策略怎么写
  • 上海集团网址关键词优化如何
  • 网站页面和图片设计营销推广方案
  • 做海报的简易网站推广普通话手抄报图片
  • 免费手机网站建设上海外贸seo
  • 大型网站制作怎么样企业中层管理人员培训课程
  • 响应式电商网站下载安装
  • 企业只有建立自己的网站平台营销网站建设制作
  • 制作一个论坛网站多少钱项目平台
  • 小程序源码怎么用四川seo选哪家
  • 网站建设与制作教学计划手机百度官网
  • 网站建设优势搜狗优化排名
  • 杭州的网站设计百度关键词排名原理
  • 武汉网站建设公司哪家专业网络营销的5种方式
  • 万网怎样做网站调试成都公司网站seo
  • 丹徒网站建设平台山西seo排名厂家
  • 云南网站建设价格低广州最新疫情通报
  • 网站建设图片如何放在网站上百度关键词搜索引擎排名优化
  • 建立网站的详细步骤知乎搜索引擎推广seo
  • 做网站都要用到框架吗深圳网络推广方法
  • 信息课做网站的软件平台推广员是做什么的
  • wordpress美化下载页面湖南网站seo找行者seo
  • 公司网站怎么做简介百度竞价关键词出价技巧
  • 基于js原生的新闻类静态网站建设滕州今日头条新闻
  • 湖州专业做网站百度网首页
  • 免费申请网站空间和域名seo网站推广案例
  • 牙膏的网站建设长沙公司网络营销推广
  • 泉州建网站哈尔滨怎样关键词优化
  • 凡科做的网站百度能收录吗互联网公司有哪些