Back to problems

Task Scheduling

Algorithm · ByteDance · Easy

Create a task scheduler that runs jobs in ascending order of their execution time, so the quickest job is selected first. Pick an appropriate data structure and algorithm that make adding tasks and retrieving the minimum-duration task efficient. Example: Task List: [ (4, Task Delta), (1, Task Echo), (2, Task Foxtrot) ] Output Order: [ Task Echo, Task Foxtrot, Task Delta ] Represent each task as a tuple whose first item gives that task's duration. Example

Checking your access…