This question evaluates competence in event-driven simulation, scheduling and queueing concepts, and algorithmic analysis by requiring computation of average customer waiting time for single and multiple shoppers.
You're building a last‑mile delivery simulator. Given n orders, each with arrival_time (non-decreasing integers) and service_time (positive integers), a single shopper processes one order at a time and is idle until the next order arrives. Compute the average customer waiting time, where waiting_time = finish_time − arrival_time. Return a floating‑point average with 5 decimal places. Follow up: Now there are k shoppers (k ≥ 1). Process orders strictly in arrival order and always assign the next order to the earliest available shopper (break ties by smallest shopper id). Compute the resulting average waiting time and analyze time and space complexity.