Back to problems

Simulate document assignment to indexers

Algorithm · Glean · Hard

Consider a document-processing service with m parallel workers, labelled from 0 to m - 1. Documents are indexed from 0 to n - 1. Document i becomes ready at time queue_time[i] and would occupy one worker exclusively for processing_time[i] time units. A worker is considered idle at time t when its previously assigned document, if any, finishes at or before t. To assign document i, let base = i % m. The service first checks worker base at time queue_time[i]. If that worker is…

Checking your access…