C++ STL之unordered_map和unordered_set的使用

unordered_map 在头文件 #include 中,

unordered_set 在头文件 #include 中。

unordered_map 和 map的区别 用法: 注意事项:
map map 会按照键值对的键 key 进行排序 如果偶尔刷题时候用 map超时了,可以考虑用 unordered_map缩短代码运行时间、提高代码效率~
unordered_map unordered_map省去了这个排序的过程  
unordered_set 和 set的区别 用法: 注意事项:
set set 里面会按照集合中的元素大小进行排序,从小到大顺序 如果偶尔刷题时候用 set超时了,可以考虑用 unordered_set缩短代码运行时间、提高代码效率~
unordered_set unordered_set省去了这个排序的过程  

你可能感兴趣的:(C++的学习笔记)