Round-robin task scheduler
Your task
Simulate a fair round-robin scheduler. You are given a list of tasks as [name, arrival_time, total_burst] and a fixed time quantum. At each step the scheduler runs the head of the ready queue for min(quantum, remaining) time units; tasks become ready (and join the tail of the queue) at their arrival_time. When a running task is preempted with work left, it re-joins the tail AFTER any tasks that arrived during its slice. Ties on arrival are broken by the order in the input list. Return the list of (name, start_time, end_time) execution slices in chronological order. If the CPU is idle and a task has not yet arrived, time fast-forwards to the next arrival.
Examples
round_robin(tasks: list[list], quantum: int) -> list[list]Example 1
Input
round_robin([["A", 0, 5], ["B", 1, 3]], 2)Output
[["A", 0, 2], ["B", 2, 4], ["A", 4, 6], ["B", 6, 7], ["A", 7, 8]]