AQA A Level · Computer Science 7517

Hash tables:練習問題

その場で採点される選択問題 5 問と、解説つきの記述問題 5 問。すべて「Hash tables」からの出題です。

10 問26 無料・登録不要
問 1
1

A hash table has 10 slots (indexed 0 to 9) and uses the hash function \(h(k) = k \text{ mod } 10\). If linear probing is used for collision resolution, where will the key 25 be stored if keys 5, 15, and 35 are already in the table in that order?

問 2
1

A hash table is implemented using chaining with linked lists to resolve collisions. The hash function is \( h(k) = k \text{ mod } 10 \). If the keys 14, 24, 34, and 44 are inserted into an empty table, what is the time complexity to search for the key 44 in the resulting data structure in the worst-case scenario, assuming the list at each index is not ordered?

問 3
1

A hash table with 100 slots uses linear probing. After many insertions and deletions, the table suffers from primary clustering. Which of the following best describes the impact of primary clustering on the table's performance and the most effective way to mitigate it using the syllabus concepts?

問 4
1

A hash table is used to store data. If the table currently contains the values 11, 22, and 33 at their hashed indices, and a new value is being inserted that hashes to an index already occupied by 22, what is the term for this occurrence, and which technique involves finding the next available slot?

問 5
1

A hash table uses a hash function \(h(k)\). If the load factor \(\alpha\) is defined as \(\frac{n}{m}\) (where \(n\) is the number of entries and \(m\) is the number of slots), which statement regarding collisions is most accurate?

問 6
2

A hash table uses the function \( h(k) = k \text{ mod } 11 \). If the keys 12 and 23 are already present, what specific term is used to describe the situation when attempting to insert the key 34?

まず自分で答えを書いてから、解説と照らし合わせましょう。

問 7
3

A hash table is designed to store exactly 100 items. Explain the specific risk of using a static hash table versus a dynamic hash table in a system where the number of entries frequently exceeds initial estimates.

まず自分で答えを書いてから、解説と照らし合わせましょう。

問 8
5

Consider a hash table using chaining with linked lists. If the hash function \( h(k) \) maps all keys to the same index, explain the resulting effect on the efficiency of data retrieval.

まず自分で答えを書いてから、解説と照らし合わせましょう。

問 9
5

A company is designing a new file storage system. They decide to use a hash table of size 13 (indices 0 to 12) with the hash function \( h(k) = k \text{ mod } 13 \).

(a) The following keys are inserted in this order: 25, 38, and 12. State the index for each key.
(b) A fourth key, 51, is now inserted. Explain why a collision occurs and, using linear probing, determine the final index where 51 will be stored.
(c) The developers are considering rehashing. Explain the circumstances under which rehashing would be triggered and how the process is performed.

まず自分で答えを書いてから、解説と照らし合わせましょう。

問 10
6

A hash table of size 11 (indices 0 to 10) uses the hash function \(h(k) = k \text{ mod } 11\). The table currently contains the following keys:
Index 1: 12
Index 5: 16
Index 6: 28

(a) A new key, 39, is to be inserted. Calculate its initial hash index and describe the collision that occurs.
(b) Using linear probing, determine the final index where 39 will be stored.
(c) Explain the difference between linear probing and chaining as collision resolution strategies.

まず自分で答えを書いてから、解説と照らし合わせましょう。

※ thinkaのコンテンツはAIにより生成されているため、内容が正確でない場合があります。補助教材としてご使用いただき、公式の教材と合わせてご確認ください。

模範解答は見ました。次はあなたの答案を採点します。

このページは良い答案の形を示せますが、あなたの答案に何が足りないかは教えられません。thinka は実際の採点基準に沿って記述答案を約 15 秒で採点します。

同じような問題をもっと解きたい?このトピックの新しい問題を、解きながら採点。

練習を始める