Computer Science I / Integrated Data-Structure Reasoning
Practice question · Multiple choice

A task manager keeps tasks in a hash map, a heap and a sorted list. A delete updates two of the three. When does the bug surface?

Hints
  1. The delete raises no error. Ask what state it leaves behind.
  2. Which structure still holds the task, and what happens the next time it is consulted?
Show the answer

B. Later and elsewhere, when run_next() returns a task the map cannot find

Why

The delete succeeds silently and the heap keeps a task nobody can look up, so the crash lands in code that did nothing wrong. That distance between cause and symptom is what makes composed structures hazardous, and precisely why the previous lesson's invariant checker earns its cost.

Read the lesson: Integrated Data-Structure Reasoning →

Practise Integrated Data-Structure Reasoning

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 Data-Structure Reasoning