Algorithm · Goldman Sachs · Medium
Requirements Input: an integer array priorities; entry priorities[i] gives the priority assigned to process i. The CPU runs processes from the highest index down to the lowest: n-1, n-2, ..., 0. Every process consumes one time unit to run. Process i is starved when there exists a later-indexed process j with a smaller priority value, meaning j > i and priorities[j] < priorities[i]. Its starvation interval starts when the first such lower-priority process begins running and…
Checking your access…