Computer Science I / Integrated Algorithm Design Practice
Practice question · Match the pairs

Match each data structure to the hot operation it makes fast.

  • Heap
  • Hash table
  • Sorted array
  • Queue
  • First-in, first-out processing
  • Binary search
  • Fast lookup by key
  • Repeatedly taking the extreme element
Hints
  1. Pick the structure whose fast operation matches what you do most.
  2. A heap gives cheap extreme-element access; a hash table gives cheap keyed lookup.
Show the answer
  • Heap Repeatedly taking the extreme element
  • Hash table Fast lookup by key
  • Sorted array Binary search
  • Queue First-in, first-out processing
Why

A heap for repeated extremes, a hash table for keyed lookup, a sorted array for binary search, a queue for FIFO order. The design rule is to make the strategy's hot operation the structure's fast one.

Read the lesson: Integrated Algorithm Design Practice →

Practise Integrated Algorithm Design Practice

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 Integrated Algorithm Design Practice