当前位置:网站首页>Deletion of the sequence table
Deletion of the sequence table
2022-07-31 10:17:00 【[email protected]】
Take the data stored in the sequence table as an example of an integer type ~
- 按位序删除
bool ListDelete(SqList &L,int i,int &e){
if(i<1||i>L.length) // i为位序
return false;
e=L.data[i-1];
for(int j=i;j<=L.length-1;j++){
//前移
L.data[j-1]=L.data[j];
}
L.length--;
return true;
}
- 按下标删除
bool ListDelete(SqList &L,int i,int &e){
if(i<0||i>L.length-1) // i为下标
return false;
e=L.data[i];
for(int j=i+1;j<=L.length-1;j++){
//前移
L.data[j-1]=L.data[j];
}
L.length--;
return true;
}
版权声明
本文为[[email protected]]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/212/202207311008456013.html
边栏推荐
猜你喜欢
随机推荐
darknet 训练分类网络
Open Kylin openKylin automation developer platform officially released
WEB核心【记录网站登录人数,记录用户名案例】Cookie技术实现
OpenGL es 导读篇
怎样使用浏览器静默打印网页
如何判断自己是否适合IT行业?方法很简单
Business-(Course-Chapter-Subsection) + Course Publishing Some Business Ideas
NowCoderTOP28-34 binary tree - continuous update ing
【LeetCode】73.矩阵置零
恋爱期间的赠与能否撤销
通过栗子来学习MySQL高级知识点(学习,复习,面试都可)
Kotlin—基本语法 (五)
湖仓一体电商项目(二):项目使用技术及版本和基础环境准备
Chapter VII
第二十三课,抗锯齿(Anti Aliasing)
Simple understanding of GCD
VMware下安装win10
尚医通【预约挂号系统】总结
【23提前批】北森云计算-测开面经
Day113. Shangyitong: user authentication, Alibaba Cloud OSS, patient management