list双向链表
// 双向链表的执行效率比较慢,一般不用这个
// 大纲里出现的,介绍一下
#include <list>
#include <bits/stdc++.h>
using namespace std;
list<int> lst;
void print(){
for (auto x : lst) cout << x << ' ';
puts("");
}
int main(){
lst.push_back(1);
lst.push_back(2);
lst.push_back(3);
print(); //1 2 3
lst.push_front(4);
lst.push_front(5);
lst.push_front(6);
print(); //6 5 4 1 2 3
lst.pop_back();
print(); //6 5 4 1 2
lst.pop_front();
print(); //5 4 1 2
return 0;
}
/*
输出
1 2 3
6 5 4 1 2 3
6 5 4 1 2
5 4 1 2
*/