Computer Science I / Choosing a Data Structure by Workload
Practice question · Multiple choice

The lesson's rule is to choose a structure by which operations dominate the workload. Why is 'which structure is fastest?' the wrong question to ask in the first place?

Hints
  1. Name the structure that beats every other at every operation.
  2. The question has no answer until something else is specified. What?
Show the answer

A. Because no structure is fastest at everything; each concedes something.

Why

The question is malformed rather than difficult: a hash table cannot produce the smallest element, a tree's lookup is logarithmic, an array's middle insertion is O(n). Every structure is a trade, and the workload — which operations, in what proportion, at what size — is what makes the question answerable. It is also why a composed structure is a legitimate answer rather than a hack.

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