Standard Template Library (STL) is a library that consist of different data structures and algorithms to effectively store and manipulate data.
Containers are data structures that provides a way to store data, like vector, lists, etc.
sort()
and find()
, that perform operations on data structures through iterators.Data Structure | Description |
---|---|
vector | Stores elements like an array but can dynamically change in size. Adding and removing of elements are usually done at the end. Elements can be accessed by index. |
list | Stores elements sequentially, where each element is connected to the next. Adding and removing of elements can be done at both ends. Not accessible by index. |
stack | Stores elements in a specific order, called LIFO (Last In, First Out), where elements are added at the end and removed from the top. Not accessible by index. |
queue | Stores elements in a specific order, called FIFO (First In, First Out), where elements are added at the end and removed from the front. Not accessible by index. |
deque | Stores elements in a double-ended queue, where elements can be added and removed from both ends. Elements can be accessed by index. |
set | Stores unique elements. Not accessible by index. |
map | Stores elements in “key/value” pairs. Accessible by keys (not by index). |
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>