Skip to content

Commit 35e895c

Browse files
committed
List in C++
1 parent 7b325e1 commit 35e895c

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

List.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//! List in C++
2+
3+
#include<iostream>
4+
#include<list>
5+
6+
// void display(list<int> &lst){
7+
// list<int>::iterator it;
8+
9+
// }
10+
using namespace std;
11+
int main(){
12+
list<int> list1; // List of 0 length
13+
// list<float> list2(5); // Empty list of size 5
14+
list1.push_back(5);
15+
list1.push_back(7);
16+
list1.push_back(57);
17+
18+
// list<int>::iterator iter;
19+
// iter = list1.begin();
20+
// cout << *iter << " ";
21+
// iter++;
22+
// cout << *iter << " ";
23+
// iter++;
24+
// cout << *iter << " ";
25+
26+
for (int x : list1)
27+
{
28+
cout << x << endl;
29+
}
30+
31+
return 0;
32+
}
33+
34+
//* list is a sequence container in C++ implemented as a doubly-linked list.
35+
//? list in C++ does NOT use contiguous memory locations.
36+
//! List is bidirectional liner list hai jo insert and delete fast
37+
// List It allows fast insertion and deletion at any position because elements are not stored contiguously in memory.

List.exe

61.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)