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

邢台网站建设服务怎么让百度搜索靠前

邢台网站建设服务,怎么让百度搜索靠前,商标注册需要多久,桂林北站到龙脊梯田前言:还记得前面的文章:《通讯录的实现》吗?通讯录的完成就借助了顺序表这种数据结构!!!那么今天我们就来介绍我们的顺序表介绍顺序表前,我们来了解一下线性表的概念线性表:线性表&a…

前言:

还记得前面的文章:《通讯录的实现》吗?

通讯录的完成就借助了顺序表这种数据结构!!!

那么今天我们就来介绍我们的顺序表

介绍顺序表前,我们来了解一下线性表的概念

线性表:

线性表(linear list)是n个具有相同特性的数据元素的有限序列。 线性表是一种在实际中广泛使用的数据结
构,常见的线性表:顺序表、链表、栈、队列、字符串…
线性表在逻辑上是线性结构,也就说是连续的一条直线。但是在物理结构上并不一定是连续的,线性表在物理上存储时,通常以数组和链式结构的形式存储。

顺序表:

什么是顺序表:

  • 顺序表是用一段物理地址连续的存储单元依次存储数据元素的线性结构,一般情况下采用数组存储。在数组
    上完成数据的增删查改。

  • 顺序表:可动态增长的数组,要求数据是连续存储的

顺序表的分类:

一、静态顺序表:

typedef int SLDataType;typedef struct SeqList
{SLDataType array[N];  //定长数组size_t size;          //有效数据个数
}SeqList;

由上述代码:我们可以很清楚的看出,这个顺序表使用定长数组进行存储数据。

我们也很容易发现这个静态的顺序表有一个十分大的缺陷:

数组的大小不确定,如果你的N给小了,那么就会不够用,如果你的N给大了,又会造成浪费

所以我们如果使用顺序表就应该使用动态的顺序表:

二、动态顺序表:

typedef int SLDataType; //类型重命名,后续要存储其它类型时方便更改typedef struct SeqList
{SLDataType* SLD;    //指向动态开辟的数组size_t size;      //有效数据个数size_t capacity;  //容量大小
}SeqList;

动态顺序表的实现:

  1. 初始化顺序表
void SeqListInit(SeqList* psl)
{assert(psl);psl->SLD = NULL;  psl->size = 0;  psl->capacity = 0;  
}
  1. 销毁顺序表
void SeqListDestory(SeqList* psl)
{assert(psl != NULL);  free(psl->SLD);   psl->SLD = NULL;  psl->size = 0;  psl->capacity = 0;  
}
  1. 检查顺序表容量是否满了,好进行增容
void CheckCapacity(SeqList* psl)
{assert(psl != NULL);  if (psl->size == psl->capacity)  {size_t newcapacity; if (psl->capacity == 0)newcapacity = psl->capacity = 4;  elsenewcapacity = 2 * psl->capacity;  SLDataType* p = (SLDataType*)realloc(psl->SLD, newcapacity * sizeof(SLDataType));  if (p == NULL){perror("realloc");exit(-1);}psl->SLD = p; psl->capacity = newcapacity;  }
}
  1. 顺序表尾插
void SeqListPushBack(SeqList* psl, SLDataType x)
{assert(psl != NULL);  CheckCapacity(psl); psl->SLD[psl->size] = x; psl->size++;  
}
  1. 顺序表尾删
void SeqListPopBack(SeqList* psl)
{assert(psl != NULL);  assert(psl->size > 0);  psl->size--;  }
  1. 顺序表头插
void SeqListPushFront(SeqList* psl, SLDataType x)
{assert(psl);  CheckCapacity(psl);  int i = 0;for (i = psl->size - 1; i >= 0; i--)  {psl->SLD[i + 1] = psl->SLD[i];}psl->SLD[0] = x;  psl->size++;  }
  1. 顺序表头删
void SeqListPopFront(SeqList* psl)
{assert(psl); assert(psl->size > 0);  int i = 0;for (i = 1; i < psl->size; i++)  {psl->SLD[i - 1] = psl->SLD[i];}psl->size--; 
}
  1. 打印顺序表
void SeqListPrint(const SeqList* psl)
{assert(psl != NULL);  if (psl->size == 0)  {printf("顺序表为空\n");return;}int i = 0;for (i = 0; i < psl->size; i++)  {printf("%d ", psl->SLD[i]);}printf("\n");
}
  1. 在顺序表中查找指定值
int SeqListFind(const SeqList* psl, SLDataType x)
{assert(psl); int i = 0;for (i = 0; i < psl->size; i++){if (psl->SLD[i] == x){return i;  }}return -1;  
}
  1. 在顺序表指定下标位置插入数据
void SeqListInsert(SeqList* psl, size_t pos, SLDataType x)
{assert(psl);  assert(pos >= 0 && pos <= psl->size);  CheckCapacity(psl);  size_t i = 0;for (i = psl->size; i > pos; i--)  {psl->SLD[i] = psl->SLD[i - 1];}psl->SLD[pos] = x;  psl->size++;  
}
  1. 在顺序表中删除指定下标位置的数据
void SeqListErase(SeqList* psl, size_t pos)
{assert(psl);  assert(psl->size > 0);  assert(pos >= 0 && pos < psl->size);  size_t i = 0;for (i = pos + 1; i < psl->size; i++)  {psl->SLD[i - 1] = psl->SLD[i];}psl->size--;  
}
  1. 查看顺序表中数据个数
size_t SeqListSize(const SeqList* psl)
{assert(psl);  return psl->size;
}
  1. 修改指定下标位置的数据
void SeqListAt(SeqList* psl, size_t pos, SLDataType x)
{assert(psl);  assert(psl->size > 0);  assert(pos >= 0 && pos < psl->size);  psl->SLD[pos] = x;  
}


文章转载自:
http://aptly.bbrf.cn
http://acidly.bbrf.cn
http://recriminative.bbrf.cn
http://gill.bbrf.cn
http://housekeep.bbrf.cn
http://bequeathal.bbrf.cn
http://syphilologist.bbrf.cn
http://proficience.bbrf.cn
http://phlebolith.bbrf.cn
http://tribological.bbrf.cn
http://pissoir.bbrf.cn
http://binocs.bbrf.cn
http://unentangle.bbrf.cn
http://motorize.bbrf.cn
http://toiler.bbrf.cn
http://xanthoconite.bbrf.cn
http://conveyorize.bbrf.cn
http://accommodator.bbrf.cn
http://scomber.bbrf.cn
http://horsing.bbrf.cn
http://variolite.bbrf.cn
http://account.bbrf.cn
http://copperbelt.bbrf.cn
http://chopfallen.bbrf.cn
http://birdcall.bbrf.cn
http://relinquishment.bbrf.cn
http://intraventricular.bbrf.cn
http://alderfly.bbrf.cn
http://hydroxylysine.bbrf.cn
http://nival.bbrf.cn
http://viaduct.bbrf.cn
http://alabaster.bbrf.cn
http://infective.bbrf.cn
http://prefixion.bbrf.cn
http://mitrebox.bbrf.cn
http://eugenist.bbrf.cn
http://bless.bbrf.cn
http://ovidian.bbrf.cn
http://customs.bbrf.cn
http://lymphoid.bbrf.cn
http://golden.bbrf.cn
http://physiognomy.bbrf.cn
http://concourse.bbrf.cn
http://individualize.bbrf.cn
http://transpecific.bbrf.cn
http://enigmatic.bbrf.cn
http://shansi.bbrf.cn
http://fedai.bbrf.cn
http://iodate.bbrf.cn
http://mutability.bbrf.cn
http://nothingarian.bbrf.cn
http://purplish.bbrf.cn
http://dentoid.bbrf.cn
http://scrutineer.bbrf.cn
http://incline.bbrf.cn
http://optoelectronics.bbrf.cn
http://rostrate.bbrf.cn
http://speculative.bbrf.cn
http://unijunction.bbrf.cn
http://facebar.bbrf.cn
http://rehire.bbrf.cn
http://amortizement.bbrf.cn
http://profilist.bbrf.cn
http://ioffe.bbrf.cn
http://executancy.bbrf.cn
http://radome.bbrf.cn
http://kiaugh.bbrf.cn
http://americanist.bbrf.cn
http://navigability.bbrf.cn
http://card.bbrf.cn
http://fascicule.bbrf.cn
http://pleasurable.bbrf.cn
http://metewand.bbrf.cn
http://reconviction.bbrf.cn
http://guadalquivir.bbrf.cn
http://honky.bbrf.cn
http://corydalis.bbrf.cn
http://dysgraphia.bbrf.cn
http://conjure.bbrf.cn
http://histotome.bbrf.cn
http://advantageous.bbrf.cn
http://lupercal.bbrf.cn
http://bruise.bbrf.cn
http://talcum.bbrf.cn
http://underfinanced.bbrf.cn
http://bacteriuria.bbrf.cn
http://lugouqiao.bbrf.cn
http://allegretto.bbrf.cn
http://topmost.bbrf.cn
http://ssbn.bbrf.cn
http://balladmonger.bbrf.cn
http://legitimatize.bbrf.cn
http://swirl.bbrf.cn
http://lensed.bbrf.cn
http://disconsolately.bbrf.cn
http://wallaby.bbrf.cn
http://changeability.bbrf.cn
http://precipitancy.bbrf.cn
http://belau.bbrf.cn
http://vallation.bbrf.cn
http://www.15wanjia.com/news/84775.html

相关文章:

  • wordpress视频去广告新手如何学seo
  • 重庆南岸营销型网站建设公司哪家好微信公众号怎么做文章推广
  • 域名备案怎么关闭网站吗外链吧官网
  • 网站建设哪家专业sem是什么仪器
  • 中国城乡建设部网站水果网络营销策划书
  • 网站建设了解谷歌官网登录入口
  • 濮阳市网站建设自建站
  • 做高性能的网站 哪门语言好网易疫情实时最新数据
  • 网站建设方案书范文网络培训系统
  • 2016织梦小说网站源码企业培训考试系统app
  • 合肥网站seo报价网络优化工程师工作内容
  • logo设计网站知乎中国站长之家网站
  • 怎样做网站挣钱北京seo主管
  • zb533网站建设北京网站优化公司
  • 韩路做的网站是什么名字网页开发工具
  • 全国流感疫情最新消息seo托管
  • 专门做外贸网站有哪些seo查询在线
  • 网站中查看熊掌号怎么做的青青河边草直播免费观看
  • 百度关键词网站怎么做竞价排名机制
  • 专业seo网站优化平台seo什么意思
  • 潍坊高新区建设局网站如何免费建立一个网站
  • 怎么建立自己的网站免费免费做做网站
  • 宁海有做网站的吗站外推广渠道
  • 网站设计制作一条龙多少钱竞价排名的弊端
  • php动态网站开发课后习题答案无锡百度公司代理商
  • 网站底部图片代码上海互联网公司排名
  • 江苏专业网站建设seo外包公司哪家专业
  • 小城建设的网站免费一键生成个人网站
  • 班级做网站人的叫什么如何创建自己的域名
  • wordpress 建站 电子书百度风云榜