From 0aafe46499b2f889da461f0a6443728aff2355a6 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 3 Jul 2020 15:20:03 +0200 Subject: [PATCH 1/3] Rename shortest_job_first_algorithm.py to shortest_job_first.py --- .../{shortest_job_first_algorithm.py => shortest_job_first.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scheduling/{shortest_job_first_algorithm.py => shortest_job_first.py} (100%) diff --git a/scheduling/shortest_job_first_algorithm.py b/scheduling/shortest_job_first.py similarity index 100% rename from scheduling/shortest_job_first_algorithm.py rename to scheduling/shortest_job_first.py From b58c20ab28791764072b69b1e04262a97fd19230 Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Fri, 3 Jul 2020 13:20:26 +0000 Subject: [PATCH 2/3] updating DIRECTORY.md --- DIRECTORY.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DIRECTORY.md b/DIRECTORY.md index f93f082d8a18..34ee376be1c3 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -591,7 +591,8 @@ ## Scheduling * [First Come First Served](https://github.com/TheAlgorithms/Python/blob/master/scheduling/first_come_first_served.py) - * [Shortest Job First Algorithm](https://github.com/TheAlgorithms/Python/blob/master/scheduling/shortest_job_first_algorithm.py) + * [Round Robin](https://github.com/TheAlgorithms/Python/blob/master/scheduling/round_robin.py) + * [Shortest Job First](https://github.com/TheAlgorithms/Python/blob/master/scheduling/shortest_job_first.py) ## Searches * [Binary Search](https://github.com/TheAlgorithms/Python/blob/master/searches/binary_search.py) From a8bd524d17129976380f031291c849d825860aac Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 3 Jul 2020 15:21:18 +0200 Subject: [PATCH 3/3] Minor tweek to round_robin.py --- scheduling/round_robin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scheduling/round_robin.py b/scheduling/round_robin.py index 10aa3ecab31f..4a79301c1816 100755 --- a/scheduling/round_robin.py +++ b/scheduling/round_robin.py @@ -23,7 +23,7 @@ def calculate_waiting_times(burst_times: List[int]) -> List[int]: rem_burst_times = list(burst_times) waiting_times = [0] * len(burst_times) t = 0 - while 1: + while True: done = True for i, burst_time in enumerate(burst_times): if rem_burst_times[i] > 0: @@ -33,7 +33,7 @@ def calculate_waiting_times(burst_times: List[int]) -> List[int]: rem_burst_times[i] -= quantum else: t += rem_burst_times[i] - waiting_times[i] = t - burst_times[i] + waiting_times[i] = t - burst_time rem_burst_times[i] = 0 if done is True: return waiting_times