Skip to content

Commit d10058a

Browse files
authored
Update 01_Containers_in_STL.md
1 parent cbf5d0f commit d10058a

File tree

1 file changed

+23
-28
lines changed

1 file changed

+23
-28
lines changed

docs/cpp/10_Standard_Template_Library/01_Containers_in_STL.md

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,56 +14,51 @@ tags:
1414
description: In this tutorial, we'll explore STL containers in C++. We'll cover the different types of Standard Template Library containers, including vectors, lists, deques, sets, maps, and more. You'll learn how to choose the appropriate container for your needs and how to use their various functions and methods. Understanding STL containers is essential for effective data management and manipulation in C++ programs, providing you with powerful tools to handle collections of data efficiently.
1515
---
1616

17-
# STL Containers
18-
1917
## Introduction
2018

2119
Containers can be described as the objects that hold the data of the same type. Containers are used to implement different data structures for example arrays, list, trees, etc.
2220

2321
## Types of STL Containers
2422

25-
Vector - Vector is a class that creates a dynamic array allowing insertions and deletions at the back.
26-
Header File: <vector>
23+
- **Vector:** Vector is a class that creates a dynamic array allowing insertions and deletions at the back.
24+
Header File: `<vector>`
2725

28-
List - List is the sequence containers that allow the insertions and deletions from anywhere.
29-
Header File: <list>
26+
- **List:** List is the sequence containers that allow the insertions and deletions from anywhere.
27+
Header File: `<list>`
3028

31-
Deque - Deque is the double ended queue that allows the insertion and deletion from both the ends.
32-
Header File: <deque>
29+
- **Deque:** Deque is the double ended queue that allows the insertion and deletion from both the ends.
30+
Header File: `<deque>`
3331

34-
Set - Set is an associate container for storing unique sets.
35-
Header File: <set>
32+
- **Set:** Set is an associate container for storing unique sets.
33+
Header File: `<set>`
3634

37-
Multiset - Multiset is an associate container for storing non- unique sets.
38-
Header File: <set>
35+
- **Multiset:** Multiset is an associate container for storing non- unique sets.
36+
Header File: `<set>`
3937

40-
Map - Map is an associate container for storing unique key-value pairs, i.e. each key is associated with only one value(one to one mapping).
41-
Header File: <map>
38+
- **Map:** Map is an associate container for storing unique key-value pairs, i.e. each key is associated with only one value(one to one mapping).
39+
Header File: `<map>`
4240

43-
Multimap - Multimap is an associate container for storing key- value pair, and each key can be associated with more than one value.
44-
Header File: <map>
41+
- **Multimap:** Multimap is an associate container for storing key- value pair, and each key can be associated with more than one value.
42+
Header File: `<map>`
4543

46-
Stack - It follows last in first out(LIFO).
47-
Header File: <stack>
44+
- **Stack:** It follows last in first out(LIFO).
45+
Header File: `<stack>`
4846

49-
Queue - It follows first in first out(FIFO).
50-
Header File: <queue>
47+
- **Queue:** It follows first in first out(FIFO).
48+
Header File: `<queue>`
5149

52-
Priority-queue - First element out is always the highest priority element.
53-
Header File: <queue>
50+
- **Priority-queue:** First element out is always the highest priority element.
51+
Header File: `<queue>`
5452

5553

5654
## Choosing the Right Container
5755

5856
Here are some general guidelines for choosing the appropriate container:
5957

60-
1. Sequential containers
61-
are used to store elements in a linear order. They include arrays, vectors, deques, lists, and forward lists.
58+
1. Sequential containers are used to store elements in a linear order. They include arrays, vectors, deques, lists, and forward lists.
6259

63-
2. Associative containers
64-
are used to store elements in a key-value relationship. They include maps, multimaps, sets, and multisets.
60+
2. Associative containers are used to store elements in a key-value relationship. They include maps, multimaps, sets, and multisets.
6561

66-
3. Container adapters
67-
provide a different interface to an existing container. They include stacks, queues, and priority queues.
62+
3. Container adapters provide a different interface to an existing container. They include stacks, queues, and priority queues.
6863

6964
Understanding STL containers is essential for effective data management and manipulation in C++ programs, providing you with powerful tools to handle collections of data efficiently.

0 commit comments

Comments
 (0)