vs | map | unordered_map |
정렬 | 오름차순 자동 정렬 | 정렬 안함 |
중복허용 | 비허용 | 비허용 |
기반 | 레드블랙트리 | hash table 기반 hash container |
메모리 | 보다 적게든다 | |
데이터가 N개일 때 탐색속도 | O(logN) | O(1) |
문자열 길이가 길고 데이터가 크지 않을 때 | 보다 유리하다 | 보다 불리하다 (길이에 그대로 반응해서) |
header | <map> | <unordered_map> |
MultiMap
- map 과 다르게 중복허용
- [] 사용불가
- hash table 로 구성
- associative container -> 노드 기반 구현
- <map>
References
https://gracefulprograming.tistory.com/3
[C++] map vs hash_map(unordered_map)
개요 hash_map은 비표준 Container인데 반해(stdext namespace에 포함) unordered_map은 C++11에서 STL 표준 Container로 추가되었으며, (사실 TR1부터 추가되었지만 C++11에서 좀 더 최적화가 이루어졌다고 합..
gracefulprograming.tistory.com
https://eocoding.tistory.com/6
hash_map | unordered_map | map 차이 비교, 특징 정리 - C++
hash_와 unordered_에 대하여 hash라는 말이 붙지 않은 map,set은 자료를 정렬해서 저장합니다. (key를 기준으로 오름차순 정렬) 따라서 순회할 때도 저장된 데이터를 넣은 순서대로가 아닌 자동정렬된
eocoding.tistory.com
http://veblush.blogspot.com/2012/10/map-vs-unorderedmap-for-string-key.html
문자열 키의 map, unordered_map 성능 비교
map 과 unordered_map 은 키, 값을 저장할 수 있는 컨테이너다. map 은 Red-Black Tree 를 사용해 키의 순서를 유지하는 반면 unoredered_map 은 해시 테이블을 사용해 키의 순서를 유지하지 않는다. unordere...
veblush.blogspot.com
http://nostalin.blogspot.com/2016/07/c-stl-map-unorderedmap_28.html
[C++ STL] map과 unordered_map의 차이점
요약 : 정리하자면 , map 은 메모리가 적게 들고 , 정렬된 상태로 저장이 된다는 점이 unordered_map 이 갖지 않은 장점이라고 할 수 있다 . 이 두 가지가 문제가 되지 않는다면 그리고...
nostalin.blogspot.com
https://ansohxxn.github.io/stl/map/
[STL 컨테이너] map & unordered_map & multimap
🔔 map 컨테이너
ansohxxn.github.io
'공부 > 복기' 카테고리의 다른 글
Vector (0) | 2022.02.22 |
---|---|
Lvalue 와 Rvalue (0) | 2022.02.22 |
평균값과 중앙값 (0) | 2022.02.22 |
Activation function 비교 (0) | 2022.02.22 |