Answer:
Above all else, let us show that this issue has the greedy choice property.
This implies that worldwide ideal arrangement can be gotten by choosing local ideal arrangements. Presently notice the following:
The global optimal solution of the issue requests us to track down the minimum number of times process_check module should be run.
It is likewise referenced that during each running interaction, process_check module should be called atleast once. Along these lines, the minimum possible number of process_check calls happens when process_check is made close to the quantity of the processes that are run.
Along these lines, we see that the global optimal solution is shaped by choosing optimal answer for the nearby advances.
Along these lines, the issue shows greedy choice property. Thus, we can utilize a greedy algorithm for this issue.
The greedy step in this calculation is to postpone the process_check as far as might be feasible. Thus, it should be run towards the finish of each interaction. So the following algorithm can be utilized:
Sort the cycles by utilizing the completion times.
Towards the finish of the 1st process in the arranged list, run the process_check module. Right now any process that is now running is removed the arranged rundown. The main interaction is additionally removed from the sorted list.
Now repeat stage 2, till all processes are finished.
In the above mentioned algorithm, the costliest advance is the step of sorting. By utilizing the optimal sorting algorithm, for example, merge sort, we can achieve it in O(n log n) asymptotic time.
Along these lines, this greedy algorithm additionally takes O(n log n) asymptotic time complexity.