티스토리 뷰
The rule to map a key to its bucket can simply be to use the key signature (modulo the number of table buckets) as the table bucket ID:
bucket_id = f_hash(key) % n_buckets;
By selecting the number of buckets to be a power of two, the modulo operator can be replaced by a bitwise AND logical operation:
bucket_id = f_hash(key) & (n_buckets - 1);
'Programming tips > algorithm' 카테고리의 다른 글
google jump consistent hash / Maglev hash (1) | 2018.03.31 |
---|---|
bit count (0) | 2018.03.31 |
cuckoo-hash : 검색시간이 O(1) (0) | 2018.03.31 |