ORIGINAL COMPANY-CONTEXT PRACTICE
Allocate scarce spare parts deterministically
Original practice scenario: A simulated aerospace supply planner assigns limited spare parts to requests with priorities and deadlines. Explain a reproducible allocation algorithm.
Written for independent practice using company context; this is not a verified question from a company interview.
A REASONED APPROACH
Model answer.
Define the allocation objective and tie-breaking policy before choosing a data structure. Priority alone does not resolve fairness, partial fulfillment or incompatible part revisions.
Work through it
- Validate quantities and compatibility, then group requests by interchangeable part class while preserving original request identity.
- Sort eligible requests using documented priority, deadline and stable identifier rules; allocate within capacity and record unmet quantities and reasons.
- Test identical priorities, zero capacity, partial quantities, incompatible revisions and cancellation replay; verify allocated totals never exceed available stock.
Tradeoffs to discuss
- Greedy allocation is explainable but may not optimize a global objective involving bundles or several constrained parts.
Common pitfalls
- Do not use input arrival order as an undocumented tie-break.
- Keep the exercise's planning recommendations separate from real operational approvals.