def METHOD_NAME(processes, n, waitingTime):
    remainingTime = [processes[i].burstTime for i in range(n)]  # Calculate the remaining burst time of each process
    complete = 0  # Keeps track of the number of processes that have completed their execution
    t = 0  # Current time
    currentMin = float('inf')  # Holds the current minimum burst time
    shortest = 0  # Index of the process with the shortest remaining burst time
    finishTime = 0  # Time at which a process finishes execution
    check = False  # Flag to check if an eligible process is found
    # Run until all processes are complete
    while complete != n:
        for j in range(n):
            # Check eligibility of process for execution
            if processes[j].arrivalTime <= t and remainingTime[j] < currentMin and remainingTime[j] > 0:
                currentMin = remainingTime[j]
                shortest = j
                check = True
        if not check:  # If no eligible process found
            t += 1
            continue
        # Decrement the remaining time of the shortest process
        remainingTime[shortest] -= 1
        currentMin = remainingTime[shortest]
        if currentMin == 0:
            currentMin = float('inf')
        # If a process has completed execution
        if remainingTime[shortest] == 0:
            complete += 1
            check = False
            finishTime = t + 1
            # Calculate waiting time for the completed process
            waitingTime[shortest] = finishTime - processes[shortest].burstTime - processes[shortest].arrivalTime
            if waitingTime[shortest] < 0:
                waitingTime[shortest] = 0
        # Increment time
        t += 1