개방 주소법과 분리 연쇄법의 해시 테이블에 대해 반환된 단어는 무작위 순서로 나타난다. 물
론 이는 키가 해싱되는 방식에 전적으로 기반하므로 무작위는 아니다. 직접 예제 코드를 실행
해보면 개방 주소법과 분리 연쇄법에 대한 순서는 아마 [표
3
-
6
]과 다를 것이다(파이썬
3
에서
문자열에 대한
hash
()
코드 값은 예측이 불가능하기 때문).
perfect
-
hash
라이브러리의 좋은 기능 하나는
perfect
_
hash
(
key
)
로 계산된 인덱스 위치
는 완벽한 해싱으로 코드를 생성할 때 사용된 단어의 순서를 기반으로 한다는 것이다. 단순히
이미 정렬된 문자열 리스트를 사용하면 엔트리는 정렬된 순서대로 저장되고 반복자는 같은 순
서로 (키, 값) 쌍을 제공할 것이다.
8
장에서는 파이썬
dict
타입을 더 상세히 다룬다. 이 장에서 했던 것처럼 처음부터 심볼 테이
블을 구현하지 말고 항상
dict
를 사용해야 한다.
dict
는 내장 타입이며 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.