티스토리 뷰

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
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함