Computer Science I / Choosing a Data Structure by Workload
Practice question · Select all that apply

Select every statement the lesson supports about choosing structures.

Hints
  1. One option turns a good default into a universal rule, which the lesson explicitly rejects.
  2. 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.

Read the lesson: Choosing a Data Structure by Workload →

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