An algorithm designer may risk redoing his work if problem is not completely understood
publish date: 2022/06/08 13:23:00 GMT+10
Correct Answer
Explanation
A computer scientist is tasked with designing an algorithm to sort a list of customer orders based on priority. However, they misunderstand the requirements and assume that priority is determined only by order value. They design an efficient sorting algorithm (e.g., a modified quicksort) that arranges orders from highest to lowest monetary value.
Later, they learn that priority also depends on:
- Customer loyalty tier (e.g., premium users come first).
- Delivery deadlines (urgent orders take precedence).
Because the problem was not fully understood initially, the algorithm fails to meet the actual requirements. The designer must now redo the work, either:
- Combining multiple sorting criteria (e.g., a stable sort by deadline, then loyalty, then value).
- Rewriting the algorithm entirely (e.g., using a priority queue with a composite key).
Result: Time and effort are wasted due to incomplete problem analysis. This highlights why thorough requirement-gathering is critical in algorithm design.
Reference
Introduction to the Design and Analysis of Algorithms, 3rd edition