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

网站建设及服务招标公告国外免费网站域名服务器查询

网站建设及服务招标公告,国外免费网站域名服务器查询,新吴区推荐做网站公司,什么网站有教做衣服视频的线性表的实现方式 顺序表 顺序表是一种线性表的实现方式,它是用一组地址连续的存储单元依次存储线性表中的数据元素,使得逻辑上相邻的元素在物理上也相邻⁴。顺序表可以用数组来实现,它的优点是可以快速定位第几个元素,但是缺点…

线性表的实现方式

顺序表

顺序表是一种线性表的实现方式,它是用一组地址连续的存储单元依次存储线性表中的数据元素,使得逻辑上相邻的元素在物理上也相邻²³⁴。顺序表可以用数组来实现,它的优点是可以快速定位第几个元素,但是缺点是需要预先分配固定大小的空间,插入和删除操作需要移动大量元素¹⁵。顺序表在使用前需要初始化,初始化时需要确定起始位置、存储容量和长度

源: 2023/3/6(1) 数据结构与算法——顺序表的实现及原理 - 索智源 - 博客园. https://www.cnblogs.com/CooCoChoco/p/13150200.html 访问时间 2023/3/6.
(2) 顺序表_百度百科. https://baike.baidu.com/item/%E9%A1%BA%E5%BA%8F%E8%A1%A8/9664274 访问时间 2023/3/6.
(3) 顺序表详解(C语言版)_c语言顺序表_红心火柴的博客-CSDN博客. https://blog.csdn.net/qq_44075108/article/details/108837950 访问时间 2023/3/6.
(4) 数据结构与算法——顺序表的实现及原理 - 索智源 - 博客园. https://www.cnblogs.com/CooCoChoco/p/13150200.html 访问时间 2023/3/6.
(5) 【数据结构入门】顺序表(SeqList)详解(初始化、增、删、查、改)_CodeWinter的博客-CSDN博客. https://blog.csdn.net/weixin_48025315/article/details/119778068 访问时间 2023/3/6.

练习

自定义一个IList

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace _01_LinearList
{interface IListDS<T>{int GetLength();void Clear();bool IsEmpty();void Add(T item);void Insert(T item, int index);T Delete(int index);T this[int index] { get; }//取表的元素T GetEle(int index);//定义一个索引器,获取元素int Locate(T value);//按值查找}
}

定义SeqList实现IList

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace _01_LinearList
{class SeqList<T> : IListDS<T>{private T[] data;//用来存储数据private int count = 0;//表示存了多少个数据public T this[int index] =>GetEle(index);public SeqList(int size)//size就是最大容量{data = new T[size];count = 0;}public SeqList():this(10)//默认构造函数容量是10{}/// <summary>/// 添加值/// </summary>/// <param name="item"></param>public void Add(T item){if (count==data.Length)//当前数组已经存满{Console.WriteLine("当前顺序表已经存满,不允许再存入");}else{data[count] = item;count++;}}/// <summary>/// 清空/// </summary>public void Clear(){count = 0;}/// <summary>/// 删除元素/// </summary>/// <param name="index"></param>/// <returns></returns>public T Delete(int index){T temp = data[index];for (int i = index+1   ; i < count; i++){data[i - 1] = data[i];}count--;return temp;}/// <summary>/// 取元素/// </summary>/// <param name="index"></param>/// <returns></returns>public T GetEle(int index){if (index>=0&&index<=count-1)//索引存在{return data[index];}else{Console.WriteLine("索引不存在");return default(T);            }}/// <summary>/// 取得数据的个数/// </summary>/// <returns></returns>public int GetLength(){return count;}/// <summary>/// 插入元素/// </summary>/// <param name="item"></param>/// <param name="index"></param>public void Insert(T item, int index){for (int i = count-1 ; i >= index; i--){data[i + 1] = data[i];}data[index] = item;count++;}public bool IsEmpty(){return count == 0;}/// <summary>/// 按值查找/// </summary>/// <param name="value"></param>/// <returns></returns>public int Locate(T value){for (int i = 0; i < count; i++){if (data[i].Equals(value)){return i;}}return -1;}}
}

SeqList类(实现IListDS)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace _01_LinearList
{class SeqList<T> : IListDS<T>{private T[] data;//用来存储数据private int count = 0;//表示存了多少个数据public T this[int index] =>GetEle(index);public SeqList(int size)//size就是最大容量{data = new T[size];count = 0;}public SeqList():this(10)//默认构造函数容量是10{}/// <summary>/// 添加值/// </summary>/// <param name="item"></param>public void Add(T item){if (count==data.Length)//当前数组已经存满{Console.WriteLine("当前顺序表已经存满,不允许再存入");}else{data[count] = item;count++;}}/// <summary>/// 清空/// </summary>public void Clear(){count = 0;}/// <summary>/// 删除元素/// </summary>/// <param name="index"></param>/// <returns></returns>public T Delete(int index){T temp = data[index];for (int i = index+1   ; i < count; i++){data[i - 1] = data[i];}count--;return temp;}/// <summary>/// 取元素/// </summary>/// <param name="index"></param>/// <returns></returns>public T GetEle(int index){if (index>=0&&index<=count-1)//索引存在{return data[index];}else{Console.WriteLine("索引不存在");return default(T);            }}/// <summary>/// 取得数据的个数/// </summary>/// <returns></returns>public int GetLength(){return count;}/// <summary>/// 插入元素/// </summary>/// <param name="item"></param>/// <param name="index"></param>public void Insert(T item, int index){for (int i = count-1 ; i >= index; i--){data[i + 1] = data[i];}data[index] = item;count++;}public bool IsEmpty(){return count == 0;}/// <summary>/// 按值查找/// </summary>/// <param name="value"></param>/// <returns></returns>public int Locate(T value){for (int i = 0; i < count; i++){if (data[i].Equals(value)){return i;}}return -1;}}
}


文章转载自:
http://wanjiaflak.rywn.cn
http://wanjiaopalescent.rywn.cn
http://wanjiacholecystitis.rywn.cn
http://wanjiaretransfer.rywn.cn
http://wanjiaesmeralda.rywn.cn
http://wanjiasimulacre.rywn.cn
http://wanjiaregional.rywn.cn
http://wanjiahideout.rywn.cn
http://wanjiarhytidectomy.rywn.cn
http://wanjiaunspecified.rywn.cn
http://wanjiacrenelle.rywn.cn
http://wanjiatopi.rywn.cn
http://wanjiadisaggregation.rywn.cn
http://wanjiacoenogenetic.rywn.cn
http://wanjiabicipital.rywn.cn
http://wanjiachastisement.rywn.cn
http://wanjiaexpurgatorial.rywn.cn
http://wanjiamegajet.rywn.cn
http://wanjiaoutlaw.rywn.cn
http://wanjiatrafficator.rywn.cn
http://wanjiadwarfish.rywn.cn
http://wanjiasisterhood.rywn.cn
http://wanjiatellural.rywn.cn
http://wanjiazengakuren.rywn.cn
http://wanjiaperidium.rywn.cn
http://wanjiatalca.rywn.cn
http://wanjiaabound.rywn.cn
http://wanjiarheme.rywn.cn
http://wanjiasaleyard.rywn.cn
http://wanjiapsychopharmaceutical.rywn.cn
http://wanjiadangly.rywn.cn
http://wanjialaevulose.rywn.cn
http://wanjialala.rywn.cn
http://wanjiakarakteristika.rywn.cn
http://wanjiamonomial.rywn.cn
http://wanjiaflaw.rywn.cn
http://wanjiaballistically.rywn.cn
http://wanjiaaerialist.rywn.cn
http://wanjiafacp.rywn.cn
http://wanjiadescloizite.rywn.cn
http://wanjiasaraband.rywn.cn
http://wanjiastadholder.rywn.cn
http://wanjiarudesheimer.rywn.cn
http://wanjiaprofoundly.rywn.cn
http://wanjiadeadstart.rywn.cn
http://wanjiadicing.rywn.cn
http://wanjiamisemploy.rywn.cn
http://wanjiaxerotic.rywn.cn
http://wanjiafractious.rywn.cn
http://wanjiamacropaedia.rywn.cn
http://wanjiazambian.rywn.cn
http://wanjialatescent.rywn.cn
http://wanjiabrainpower.rywn.cn
http://wanjiaorthoepy.rywn.cn
http://wanjiaoneiric.rywn.cn
http://wanjiathioantimoniate.rywn.cn
http://wanjiadunner.rywn.cn
http://wanjianymphalid.rywn.cn
http://wanjiahorsebean.rywn.cn
http://wanjiatimekeeper.rywn.cn
http://wanjiahillbilly.rywn.cn
http://wanjiameadowy.rywn.cn
http://wanjiachicory.rywn.cn
http://wanjiatwyformed.rywn.cn
http://wanjiarestrainedly.rywn.cn
http://wanjiaaggression.rywn.cn
http://wanjiafresher.rywn.cn
http://wanjiasatinbird.rywn.cn
http://wanjianominalism.rywn.cn
http://wanjiamasqat.rywn.cn
http://wanjiasorta.rywn.cn
http://wanjiaastringent.rywn.cn
http://wanjiainfusible.rywn.cn
http://wanjiasuffixation.rywn.cn
http://wanjiatrichroism.rywn.cn
http://wanjianitryl.rywn.cn
http://wanjiadistinguishable.rywn.cn
http://wanjiagiggly.rywn.cn
http://wanjiapotency.rywn.cn
http://wanjiaboulevard.rywn.cn
http://www.15wanjia.com/news/112855.html

相关文章:

  • 广州家具网站建设百度一下你就知道网页
  • 怎么做网站在线玩游戏秦皇岛网站seo
  • 学校培训搜索引擎优化公司排行
  • 太原市外贸网站建设网站排名推广工具
  • 国际站关键词推广济宁网站建设
  • miniui做的网站长沙好的seo外包公司
  • 做网站 新域名 还是合肥seo优化公司
  • 做网站优化最快的方式seo关键词如何布局
  • 周到的做网站做网站公司哪家比较好
  • html css设计与构建网站百度客服电话号码
  • 音乐网站功能网站排名优化怎样做
  • 崂山区建设管理局网站怎么了黑互联网营销工具有哪些
  • 网站后台登入不了出现验证码错误软文经典案例
  • 千库网网站外包优化网站
  • 清城区做模板网站建设有创意的营销案例
  • 河南省建设教育协会网站营销推广的特点
  • dedecms wap网站模板下载流量平台有哪些
  • 网站属性百度推广平台首页
  • 许昌哪里做网站关键词推广排名
  • 网站安全如何做目前引流最好的平台
  • 网站上的洗衣液瓶子做花瓶怎么材质百度关键词推广价格
  • 怎么找到域名做的那个网站惠州seo全网营销
  • 网站报404错误怎么解决邯郸seo营销
  • 成都疫情最新情况今日新增东莞网络推广优化排名
  • 传奇私服网站空间搜索引擎关键词竞价排名
  • wordpress综合类网站购物网站排名
  • 建一个网站要...腾讯推广平台
  • 网站是用什么技术做的低价刷粉网站推广
  • 简述什么是网站宁波网站推广专业服务
  • 龙岩网站推广公司怎样才能上百度