Computer Science I / Abstract Data Types and Interfaces
Practice question · True or false

Documenting a List ADT by writing down the array implementation's exact timings makes the documentation more useful, because callers know what to expect.

Hints
  1. What happens when the implementation is later swapped?
  2. The point of an ADT is that callers depend on the interface only.
Show the answer

False

Why

False. It converts an implementation detail into a promise. Callers write code that relies on O(1) indexing, and swapping in a linked list, still a correct List, silently makes them quadratic. Document the contract (asymptotic bounds the ADT guarantees), not the timings one implementation happens to have.

Read the lesson: Abstract Data Types and Interfaces →

Practise Abstract Data Types and Interfaces

The app has 6 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.

More questions on Abstract Data Types and Interfaces