Skip to content

Commit 2892cea

Browse files
authored
2020. 06. 03. Added basics
1 parent 42a380d commit 2892cea

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Diff for: 07_hash/3_hash_map/README.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Hash Map
2+
- dictionary pair(key, value)의 key값에 해시함수를 적용해서 구한 hash값의 위치에 dictionary pair를 저장하는 자료구조
3+
- __해시셋 vs 해시맵__
4+
- Hash __Set__
5+
- Null 값을 가진 원소를 1개 허용함
6+
- 요소(data)의 중복을 허용하지 않음
7+
- e.g. {1, 2, 3, 4, 5}
8+
- Hash __Map__
9+
- key값과 그에 연관된 value값을 하나의 dictionary pair를 요소로 함 (key, value)
10+
- Null값을 가진 key 1개와 Null값을 가진 value 복수 개를 허용함
11+
- 첫번째요소(key)의 중복을 허용하지 않지만, 두번째요소(value)의 중복은 허용함
12+
- e.g. {a -> 1, b -> 2, c -> 2, d -> 1}
13+
14+
- __참고자료__
15+
- [Difference between HashSet and HashMap](https://stackoverflow.com/questions/2773824/difference-between-hashset-and-hashmap)
16+
<br>
17+
18+
## Nadarm's Exercise
19+
- [예제(원본)](https://github.com/nadarm/42-algorithm/tree/master/hash/hash_map)
20+
- 구현
21+
- [map_init](./map_init.c) : t_hash_map형 struct를 반환
22+
- [map_insert](./map_insert.c) : hash map에 (key, value)를 삽입
23+
- [map_get](./map_get.c) : hash map 안에 key가 존재한다면 (key, value) 반환
24+
- [map_delete](./map_delete.c) : hash map에서 key가 존재한다면 (key, value) 삭제
25+
- [free_set](./free_map.c) : hash map 전체를 비우고 hash map의 메모리 해제
26+
- [header](./map.h) : t_node구조체(key,value,,next) 선언, t_hash_map구조체(t_node,size) 선언
27+
<br>
28+
29+
[맨 위로](#hash-map)

0 commit comments

Comments
 (0)