From 98cc298e61a300493fd2447922908494d028315f Mon Sep 17 00:00:00 2001 From: YasirChoudhary Date: Sun, 7 Oct 2018 14:33:56 +0530 Subject: [PATCH] Optimised for loop iteration --- sorts/selection_sort.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorts/selection_sort.py b/sorts/selection_sort.py index 432d14090..c1d66c5a8 100644 --- a/sorts/selection_sort.py +++ b/sorts/selection_sort.py @@ -31,7 +31,7 @@ def selection_sort(collection): """ length = len(collection) - for i in range(length): + for i in range(length - 1): least = i for k in range(i + 1, length): if collection[k] < collection[least]: