当前位置:网站首页>顺序表有关操作
顺序表有关操作
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进行比较,相同返回位序
(按值查找)
边栏推荐
- Istio, ebpf and rsocket Broker: in depth study of service grid
- Leetcode (Sword finger offer) - 58 - ii Rotate string left
- Prepare for the Blue Bridge Cup Day10__ PWM control light brightness
- Computer graduation project asp Net hotel room management system VS development SQLSERVER database web structure c programming computer web page source code project
- Value/sortedset in redis
- Theoretical basis of graph
- Software project management 9.2 Software project configuration management process
- 91.(cesium篇)cesium火箭发射模拟
- How to set decimal places in CAD
- 对于mvvm和mvc的理解
猜你喜欢

LeetCode力扣(剑指offer 31-35)31. 栈的压入弹出序列32I.II.III.从上到下打印二叉树33. 二叉搜索树的后序遍历序列34. 二叉树中和为某一值的路径35. 复杂链表的复制

比特熊直播间一周年,英雄集结令!邀你来合影!

研发效能度量框架解读

Comment Cao définit la décimale de dimension

C serialization simple experiment

Computer graduation project asp Net hotel room management system VS development SQLSERVER database web structure c programming computer web page source code project
![[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 8](/img/16/e1a0a52964c8a55eb729469114fc60.jpg)
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 8
![Wechat applet reports an error: [rendering layer network layer error] pages/main/main Local resource pictures in wxss cannot be obtained through wxss. You can use network pictures, Base64, or < image/](/img/6a/fe448ca635690bc5260436546b588e.jpg)
Wechat applet reports an error: [rendering layer network layer error] pages/main/main Local resource pictures in wxss cannot be obtained through wxss. You can use network pictures, Base64, or < image/

陈珙:微服务,它还那么纯粹吗?

uniapp 使用 uni-upgrade-center
随机推荐
Uniapp uses uni upgrade Center
Use of easyexcel
Powerful, easy-to-use, professional editor / notebook software suitable for programmers / software developers, comprehensive evaluation and comprehensive recommendation
自组织是管理者和成员的双向奔赴
Is it safe for Huatai Securities to open an account online?
MQ prevent message loss and repeated consumption
CPU 上下文切换的机制和类型 (CPU Context Switch)
I'm in Zhongshan. Where is a better place to open an account? Is it actually safe to open an account online?
Comment Nike a - t - il dominé la première place toute l'année? Voici les derniers résultats financiers.
比特熊直播间一周年,英雄集结令!邀你来合影!
二叉堆(一) - 原理与C实现
The specified service is marked for deletion
研发效能度量框架解读
Value/sortedset in redis
How to understand the developed query statements
Wechat applet reports an error: [rendering layer network layer error] pages/main/main Local resource pictures in wxss cannot be obtained through wxss. You can use network pictures, Base64, or < image/
Joint Time-Frequency and Time Domain Learning for Speech Enhancement
The operation process of using sugar to make a large data visualization screen
Seckill system 03 - redis cache and distributed lock
Self organization is the two-way rush of managers and members




