卷別
資料結構及演算法
計算國立政治大學 2026 · 考試 · 第 13 題
Consider a hash table of size (slots indexed from 0 to 19). The primary hash function is defined as: . The secondary hash function is defined as: . Assume the hash table is initially empty before each part of the question. We will insert the following sequence of keys in the order given:
(a) (5%) Assuming we use double hashing for collision resolution, determine the final structure of the hash table after all keys in have been inserted. Note: The probe sequence is given by:
where is the probe number.
(b) (5%) If we search for 48, what is the total number of probes made during the search?
(c) (10%) Suppose we are given keys, hash table slots, and two uniform hash functions and . Further suppose hashing scheme uses for the odd keys and for the even keys. What is the expected number of keys in a slot?