当前位置:网站首页>顺序表有关操作
顺序表有关操作
2022-07-01 12:05:00 【Between the steps】
**
对于顺序表的有关操作
对于顺序表的有关操作
**
1、首先是顺序表的初始化(静态)
在初始化时,定义最大长度(和数组一样,不能扩展),还有当前存入数据实际长度,初始化将实际长度定义为0,后续插入值再递增,,

改进(动态分配)
如果内存不够的话,会进行扩充空间 ,将原来的内容复制过去
(红线指向顺序表当中的第一个数据元素)
从下图看 (扩充多少空间?)
定义指针p指向第一个数据位置,然后用L.data扩充空间,再复制过去,顺序表的最大长度更新

顺序表的插入操作------------------
我们在线性表的第i个位置插入元素e 返回更新线性表(&) ,思想就是后面整体后移,将e插入进去,

同时我们也要判断空间是否已经满了,,,或者没满插入的地方超过了最大长度也不可以!!!!!!
顺序表的删除操作-------------------
删除操作是将第i个的值扣掉 ,后面的元素前移 可以看到参数的(&)
我们先将删除的数据拿出来等待返回
删除和插入相反 是从前面拿掉后后面前移

顺序表的查找操作------------------
静态内存分配的查找只需返回return L.data[i-1] 即可 (注意第i个位序,数组是data[i-1])
(按位查找)
按值查找的话 通过传参e比较
通过遍历L.data[i]和e进行比较,相同返回位序
(按值查找)
边栏推荐
- Force button homepage introduction animation
- [classic example] classic list questions @ list
- leetcode 406. Queue reconstruction by height
- How to set decimal places in CAD
- Machine learning - Data Science Library - day two
- [Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 6
- S7-1500plc simulation
- Learning summary on June 29, 2022
- Uniapp uses uni upgrade Center
- Message queue monitoring refund task batch process
猜你喜欢

迅为i.MX8Mmini开发板离线构建Yocto系统

Istio、eBPF 和 RSocket Broker:深入研究服务网格

MQ prevent message loss and repeated consumption

Theoretical basis of graph

如何看懂开发的查询语句

MQ-防止消息丢失及重复消费

Prepare for the Blue Bridge Cup Day10__ PWM control light brightness

深入理解 grpc part1

Comment Cao définit la décimale de dimension

自组织是管理者和成员的双向奔赴
随机推荐
Use of easyexcel
谈思生物直播—GENOVIS张洪妍抗体特异性酶切技术助力抗体药物结构表征
消息队列之监控退款任务批处理过程
Machine learning - Data Science Library Day 3 - Notes
Computer graduation project asp Net attendance management system vs developing SQLSERVER database web structure c programming computer web page source code project
耐克如何常年霸榜第一名?最新财报答案来了
91.(cesium篇)cesium火箭發射模擬
Machine learning - Data Science Library - day two
Onenet Internet of things platform - create mqtts products and devices
241. 为运算表达式设计优先级 : DFS 运用题
耐克如何常年霸榜第一名?最新財報答案來了
Joint Time-Frequency and Time Domain Learning for Speech Enhancement
【20211129】Jupyter Notebook远程服务器配置
One year anniversary of bitbear live studio, hero rally order! I invite you to take a group photo!
Uniapp uses uni upgrade Center
I'm in Zhongshan. Where is a better place to open an account? Is it actually safe to open an account online?
Want to ask, is there a discount for opening a securities account? Is it safe to open a mobile account?
Force button homepage introduction animation
迅为i.MX8Mmini开发板离线构建Yocto系统
USB peripheral driver - cable connect/disconnect




