File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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.
You can’t perform that action at this time.
0 commit comments