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

宜昌外贸网站建设优化推广/搜索引擎技术基础

宜昌外贸网站建设优化推广,搜索引擎技术基础,广东省 网站制作,看男女做那个真实视频网站[数据结构]之顺序表 描述顺序表:是指在一段连续的存储单元存储数据的线性表。多使用数组来实现。 数据结构 1 属性: 最大长度 CAP 当前长度 Length 存储数组 Elements 2 操作: Get(index) 获取元素 Insert(index,elem) 插入元素 Delete(index) 删除第ind…

[数据结构]之顺序表

描述
顺序表:是指在一段连续的存储单元存储数据的线性表。多使用数组来实现。

数据结构

1 属性:

最大长度 CAP

当前长度 Length

存储数组 Elements


2 操作:

Get(index) 获取元素

Insert(index,elem) 插入元素

Delete(index) 删除第index个元素

 

## 实现
使用go语言实现代码如下:

    package mainimport ("fmt")const CAP = 20type SqList struct {elemets [CAP]stringlength  int}/**    获取顺序表的第index元素*/func (list *SqList) Get(index int) (string, error) {if list.length == 0 || index < 0 || index > list.length-1 {return "", fmt.Errorf("the index %d Out Of Bounds", index)}return list.elemets[index], nil}/**    插入顺序表元素,在第index位置*/func (list *SqList) Insert(index int, elem string) error {if list.length == CAP {return fmt.Errorf("the list is full")}if index < 0 || index > list.length {return fmt.Errorf("the index %d Out Of Bounds", index)}//如果不是在最后插入,需要移动后面的元素if index < list.length {for i := list.length - 1; i >= index; i-- {list.elemets[i+1] = list.elemets[i]}}list.elemets[index] = elemlist.length++return nil}/**    删除顺序表元素,在第index位置*/func (list *SqList) Delete(index int) error {if list.length == 0 {return fmt.Errorf("the list is empty")}if index < 0 || index > list.length {return fmt.Errorf("the index %d Out Of Bounds", index)}//如果不是在最后删除,需要移动后面的元素if index < list.length {for i := index; i < list.length; i++ {list.elemets[i] = list.elemets[i+1]}}list.length--return nil}func main() {list := &SqList{}list.Insert(0, "AAAAA")list.Insert(1, "BBBBB")list.Insert(2, "CCCCC")list.Delete(1)for i := 0; i < list.length; i++ {elem, _ := list.Get(i)fmt.Printf("get elem %d value:%v\n", i, elem)}}

 

转载于:https://www.cnblogs.com/sxt102400/p/3234231.html

http://www.lbrq.cn/news/1376659.html

相关文章:

  • WordPress 4.9添加备案号/安徽网站seo公司
  • 网站建设div设置圆角/北京seo网络优化师
  • 网站空间面板/永久免费不收费的污染app
  • 可以看的网站都有哪些/长沙网站关键词排名
  • 手机网站自动适应/哪家建设公司网站
  • 网站建设(中企动力)/平谷头条新闻
  • ecshop 企业网站/100个关键词
  • 网站制作怎么学/在百度上打广告找谁
  • 网站建设励志文章/整合营销沟通
  • 一站式网站建设报价/南宁网站建设及推广
  • 做网站 流量怎么抓钱/百度推广一般多少钱
  • 文安做网站shijuewang/免费网站注册com
  • 营销型网站建设实战感想/自创网站
  • html网站设计源码/今日中央新闻
  • 制作网站的公司注册资本要多少/站长之家seo综合查询
  • wordpress主页删除/seo上排名
  • seo网站推广杭州/做网站公司哪家比较好
  • 怎么做网站统计/创意营销策划方案
  • 做网站会遇到什么问题/提升seo排名
  • 优质做网站费用/百度小程序怎么进入
  • 网站推广网络推广/如何网络营销自己的产品
  • 做购物类网站有哪些/市场调研报告500字
  • 知乎系统是wordpress/公众号seo排名软件
  • 网站备案承诺书/seo查询在线
  • 开通网站后/中国seo排行榜
  • 牡丹江站/可免费投放广告的平台
  • php mysql网站开发.../免费推客推广平台
  • 网络营销的5种方式/邯郸seo优化公司
  • c网站开发源代码/搜索引擎优化seo网站
  • 没有空间可以做网站吗/手机百度app下载
  • linux81 shell通配符:[list],‘‘ ``““
  • SpringBoot与Rust实战指南
  • 向日葵软件提权
  • Selenium:强大的 Web 自动化测试工具
  • 进程控制:从创建到终结的完整指南
  • HTML应用指南:利用POST请求获取全国公牛门店位置信息