When faced with a problem, assess suitability by asking:
1. What data needs to be stored? → Choose an ADT
2. How is the data accessed? → Which ADT operations match?
3. What is the problem structure? → Which design pattern applies?
4. What are the constraints? → Does complexity fit the input size?
KEY TAKEAWAY: Suitability is about fit — the ADT/pattern that best matches the problem’s operations, scale, and correctness requirements.
Problem: Find the shortest route between two cities in a road network.
Problem: Process jobs in order of urgency; new jobs arrive continuously.
insert and removeMin in \(O(\log n)\); jobs retrieved by priority, not arrival orderProblem: Visit all reachable web pages from a starting URL.
Problem: Find a path from entrance to exit in a maze.
Problem: Count how many times each word appears in a document.
When multiple ADTs/patterns could work, complexity is the tiebreaker:
| Input size \(n\) | Acceptable complexity |
|---|---|
| \(n \leq 20\) | \(O(n!)\), \(O(2^n)\) feasible |
| \(n \leq 1000\) | \(O(n^3)\) feasible |
| \(n \leq 10^6\) | \(O(n \log n)\) required |
| \(n \leq 10^8\) | \(O(n)\) or \(O(\log n)\) required |
EXAM TIP: When justifying suitability, mention both the functional fit (the ADT supports the required operations) and the efficiency (the complexity is appropriate for the problem’s scale).
“The [ADT] is suitable because the problem requires [operation], which the [ADT] supports in [complexity]. The [design pattern] is appropriate because [property of the problem] means that [why the pattern applies].”
Example: “The priority queue is suitable because the problem requires repeatedly finding the minimum-cost edge, which the priority queue supports in \(O(\log n)\). The greedy pattern is appropriate because the cut property guarantees that choosing the minimum edge at each step produces the global minimum spanning tree.”
VCAA FOCUS: Justification must be specific to the problem scenario — generic statements like “it’s efficient” are insufficient. Tie the ADT’s operations directly to the problem’s requirements.