hce_kmu
109年
計算機概論與程式設計
第 6 題
Suppose a hashed file is constructed using the division hash algorithm of “key-value mod size”. Assume that indices of the hash table are labeled 0⋯6. The sequence of inserting the following key-values into the hash table is 24, 30, 3, 18, 15, 21, 9. To read the keys out from the table following the order of 0⋯6 of the hash table's indices, which of the following might be the possible sequence?
- A 24, 30, 3, 18, 15, 21, 9
- B 3, 9, 15, 18, 21, 24, 30
- C 21, 15, 9, 30, 3, 24, 18
- D 3, 9, 18, 21, 30, 24, 15
- E 21, 15, 30, 9, 24, 3, 18
思路引導 VIP
當多個數值經過運算後都指向同一個索引位置(例如餘數相同),如果我們不希望把數字搬移到其他索引(如索引 +1),而是想辦法讓它們在「同一個位置」排隊,那麼在按順序讀取雜湊表時,這些數字的排列規律會受到什麼因素影響?
🤖
AI 詳解
AI 專屬家教
太棒了!你能精準選出 (E),代表你對雜湊表(Hash Table)的運作邏輯,尤其是對「碰撞處理(Collision Resolution)」的機制有著非常扎實的理解。
除法雜湊與鏈結法運算
這題的核心在於應用除法雜湊法(Division Method),其公式為 $h(key) = key \pmod 7$。我們將題目給予的數值依序代入:
▼ 還有更多解析內容