summaryrefslogtreecommitdiffhomepage
path: root/c++.html.markdown
diff options
context:
space:
mode:
authorAnkush Agarwal <ankushagarwal11@gmail.com>2018-10-22 08:44:21 -0700
committerGitHub <noreply@github.com>2018-10-22 08:44:21 -0700
commit129abf6113a48f928b5b8b47a54ff60184947cea (patch)
tree50d0f1a0ed0c3ff2aa39363d23f16095e84bb6dd /c++.html.markdown
parent88e24ff1a4311f5349d5919860e08d2eb39d6db7 (diff)
Add comments about unordered_map and unordered_set
Diffstat (limited to 'c++.html.markdown')
-rw-r--r--c++.html.markdown2
1 files changed, 2 insertions, 0 deletions
diff --git a/c++.html.markdown b/c++.html.markdown
index 8be5a278..f1ad0790 100644
--- a/c++.html.markdown
+++ b/c++.html.markdown
@@ -1027,6 +1027,7 @@ for (it = my_vector.begin(); it != my_vector.end(); ++it) {
// Set
// Sets are containers that store unique elements following a specific order.
+// For hash sets, use unordered_set. They are more effecient but do not preserve order.
// Set is a very useful container to store unique values in sorted order
// without any other functions or code.
@@ -1061,6 +1062,7 @@ cout << ST.size(); // will print the size of set ST
// Map
// Maps store elements formed by a combination of a key value
// and a mapped value, following a specific order.
+// For hash maps, use unordered_map. They are more effecient but do not preserve order.
#include<map>
map<char, int> mymap; // Will initialize the map with key as char and value as int