当前位置:网站首页>45. [Application of list linked list]
45. [Application of list linked list]
2022-07-30 23:34:00 【Lee is struggling...】
[Insert a data in the header]
Function name.push_front()
[Insert a data at the end]
Function name.push_back()
【Multiple Insertion Data】
Function name.insert(function name.begin(),n) Where to start and who to insert
[Multiple Insertion Data 2]
Function name.insert(function name.begin(),n,m) Where to start, how many to insert, who to insert
[Insert using iterator]
iist
Object name=function name.begin();
Function name.insert(object name, number, element)
[Delete the first element]
Function name.pop_front()
[Remove last element]
Function name.pop_back()
【Multiple delete data】
function name 1.erase(function name 1.begin(), function name 1.end()
[Linked list traversal can only be iterator traversal]
iist
for(object name=function name.begin();object name!=end();object name++)
{
cout<<*object name;
}
#include
#include
using namespace std;
int main()
{
list
int s[4] = { 2,5,8 };
list
list_b.push_front(1); //Insert at the head
list_b.push_back(2); //Insert at the end
list_b.insert(list_b.begin(), 66); // where to insert, what to insert
list_b.insert(list_b.end(), 88);
list_b.insert(list_b.end(),3, 100); // where to insert, how many to insert, who to insert
list
it = list_b.begin();
it++;
list_b.insert(it, 5, 111);
list_b.insert(list_b.begin(), s, s + sizeof(s) / sizeof(int)); //insert a normal array
list_b.pop_front(); //delete the first one
list_b.pop_back(); //delete the last one
//list_b.erase(list_b.begin(), list_b.end()); // delete from the beginning
list
for (itor = list_b.begin(); itor!= list_b.end(); itor++)
{
cout << *itor << " ";
}
return 0;
}


边栏推荐
- Apache Doris系列之:安装与部署详细步骤
- 2021GDCPC Guangdong University Student Programming Competition B.Byfibonacci
- 游戏商城表建立
- mysql中关于存储过程无法实现迁移复制表中数据问题
- uni-ui installation
- Detailed operator
- 天空云变化案例
- Necessary artifacts - AKShare quants
- Debezium报错系列之二十:task failed to create new topic.Ensure that the task is authorized to create topics
- oracle数据库版本问题咨询(就是对比从数据库查询出来的版本,和docker里面的oracle版本)?
猜你喜欢
![[MySQL] Related operations on databases and tables in MySQL](/img/a5/c92e0404c6a970a62595bc7a3b68cd.gif)
[MySQL] Related operations on databases and tables in MySQL

从编译的角度来学作用域!

In MySQL, the stored procedure cannot realize the problem of migrating and copying the data in the table

测试人面试 常被问到的计算机网络题,高薪回答模板来了

# # yyds dry goods inventory interview will brush TOP101: to determine whether there is a part of the list

@requestmapping注解的作用及用法

Shell编程条件语句 test命令 整数值,字符串比较 逻辑测试 文件测试

可视化工具Netron介绍

PS Basic Learning (1)

CPM:A large-scale generative chinese pre-trained lanuage model
随机推荐
flex-direction容器属性
"Wei cup" school more than 2022 cattle summer camp 4 Nancy (polocy) pelosi article variance law of Arts
[MySQL] DQL related operations
HCIP第十六天笔记
The difference between ?? and ??= and ?. and || in JS
transition过渡&&animation动画
Abstract classes and interfaces (study notes)
2022牛客暑期多校训练营1 J Serval and Essay
$\text{ARC 145}$
HCIP第十五天笔记
(WebFlux)001、如何自定义注解实现功能
二叉查找树的定义,查找,插入,删除
HF2022-EzPHP reproduction
Android安全性优化——APP加固
雪佛兰开拓者,安全保障温暖你的家庭出行的第一选择
The performance management method OKR is used by all companies
2022 China Logistics Industry Conference and Entrepreneur Summit Forum will be held in Hangzhou!
Day016 类和对象
【VisDrone数据集】YOLOV3训练VisDrone数据集步骤与结果
Android security optimization - APP reinforcement