Practice question · Select all that apply
Select every statement the lesson supports about choosing structures.
Hints
- One option turns a good default into a universal rule, which the lesson explicitly rejects.
- Ask what a hash table does when you need the keys in order.
Show the answer
- A. There is no universally best data structure
- C. Extra memory can often be traded for faster operations
- D. Two structures can be combined so that each handles what it is best at
- E. The right choice depends on which operations dominate
Why
No universal best, dominance of the hot path, the space-time trade and combining structures are all stated. The false option is the universal hash table: it is a superb default for keyed lookup and the wrong choice the moment order or ranges are needed. Picking by habit is the named pitfall.
Practise Choosing a Data Structure by Workload
The app has 5 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.
More questions on Choosing a Data Structure by Workload
- The lesson's rule is to choose a structure by which operations dominate the workload. Why is 'which structure…
- A hash table serves a workload of 90% lookups by key and 10% requests for the smallest key well, because the…
- Sort each requirement by whether a hash table alone is enough for it.
- Order the steps of choosing a data structure by workload, as the lesson describes it.
- A cache needs fast lookup by key and eviction of the least recently used entry. No single structure does…