Standard Template Library
1. What/Why we need STL (Standard Template Library) ?
2. Common STL components
3. Problems on STL
2. Algorithms (Sorting, Searching and ...etc)
e.g. Sorting, Searching and ...etc
1. Containers / Data-Structures
e.g. Vectors, Sets, Maps, Queues, Stacks and ...etc
What does STL mean?
- It provides High Level Implementation
- For example Queue data-structure
There is no need to handle all its operations
1. What/Why we need STL (Standard Template Library) ?
2. Common STL components
3. Problems on STL
2. Algorithms (Sorting, Searching and ...etc)
e.g. Sorting, Searching and ...etc
1. Containers / Data-Structures
e.g. Vectors, Sets, Maps, Queues, Stacks and ...etc
Vectors
â—‹ Like array but dynamic
- dynamic means that it has the ability to resize itself automatically
â—‹ Like array but dynamic
Let's jump into code
Vectors
- FIFO (First In First Out)
Queues
â—‹ inserted at the back (end) and are deleted from the front
- FIFO (First In First Out)
Let's jump into code
Queues
Sets
{1, 3, 4, 3} = {1, 3, 4, 4} = {1, 3, 4 }
1. Each element has to be unique
2. Sorts its elements by default
Let's jump into code
Sets
1. Similar to sets, have the same list of
Multiset
2. multiple elements can have the same values (Allow duplicated)
1. Similar to sets, have the same list of operations
1. Similar to sets, have the same list of
2. The order of the elements is not sorted
1. Similar to sets, have the same list of operations
unordered_set
1. Store elements in mapped fashion (Key - Values)
2. Sorted by key
Map
Let's jump into code
Map
2. The order of the elements is not sorted
1. Similar to maps, have the same list of operations
unordered_map
Stack
â—‹ inserted at the top and are deleted from the top
- FILO (First In Last Out)
Let's jump into code
Stack
Priority Queue
Elements will be processed based on some criteria
Let's jump into code
Priority Queue
1. What/Why we need STL (Standard Template Library) ?
2. Common STL components
3. Problems on STL
2. Algorithms (Sorting, Searching and ...etc)
e.g. Sorting, Searching and ...etc
1. Containers / Data-Structures
e.g. Vectors, Sets, Maps, Queues, Stacks and ...etc
Sorting - Searching - Utilities
Let's jump into code
Sorting - Searching - Utilities