Prepare for the 241 Computer Science Certification Exam with comprehensive flashcards and multiple choice questions. Enhance knowledge with explanations and hints to excel in your test journey!

Multiple Choice

Which factors affect the worst-case performance of a hash table?

The worst-case performance of a hash table depends on how many items you store relative to the number of buckets, how evenly those items are distributed across buckets, and how collisions are actually handled when they occur. If the table becomes very full (high load factor), you’re more likely to encounter long chains or long sequences of probes, so operations can take much longer in the worst case. A hash function that doesn’t spread keys well can cause many keys to collide into the same buckets, creating these long chains or probe sequences even when the table isn’t very full. The way collisions are resolved sets the exact shape of those worst-case scenarios: separate chaining can lead to very long chains in a single bucket, while open addressing creates lengthy probe sequences as you try to find an empty slot or the desired key. Because all three factors—load factor, hash function quality, and collision resolution strategy—interact to determine how bad the worst case can get, considering all of them gives the most complete picture.

The worst-case performance of a hash table depends on how many items you store relative to the number of buckets, how evenly those items are distributed across buckets, and how collisions are actually handled when they occur. If the table becomes very full (high load factor), you’re more likely to encounter long chains or long sequences of probes, so operations can take much longer in the worst case. A hash function that doesn’t spread keys well can cause many keys to collide into the same buckets, creating these long chains or probe sequences even when the table isn’t very full. The way collisions are resolved sets the exact shape of those worst-case scenarios: separate chaining can lead to very long chains in a single bucket, while open addressing creates lengthy probe sequences as you try to find an empty slot or the desired key. Because all three factors—load factor, hash function quality, and collision resolution strategy—interact to determine how bad the worst case can get, considering all of them gives the most complete picture.