1. Engineering
  2. Computer Science
  3. you have a complex project involving m independent tasks since...

Question: you have a complex project involving m independent tasks since...

Question details

You have a complex project involving m independent tasks. Since the tasks can be performed in parallel, the time to complete the project will be the maximum time taken by any task. You’d like to hire one of k companies to do the whole project, and you’re given a 2- dimensional list x with k rows and m columns, where x[i][j] is the amount of time company i would take to complete task j. Write a Python function hire(x) to help you decide which company to hire; it should return a pair (i, j) where i is the index of the company that will finish the project quickest, and j is the index of the task that will take them the longest (the “bottleneck”). The running time should be O(km), i.e., linear as a function of the total number of entries. For example, hire([[1, 4], [3, 2]]) should return (1, 0). Do not use Python’s built-in min or max functions.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution