From f60f8e6f4b226c3af938d295ab26cd36df164350 Mon Sep 17 00:00:00 2001 From: Mikhail Bulavkin Date: Tue, 3 Nov 2020 20:32:26 +0300 Subject: [PATCH] Selection sort fix --- include/selectionSort.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/selectionSort.h b/include/selectionSort.h index 44265d0..2f15d4e 100644 --- a/include/selectionSort.h +++ b/include/selectionSort.h @@ -33,7 +33,7 @@ namespace algo { for ( i = start; i <= end - 1; ++i ) { //let us assume element at start index is smallest minIndex = i; - for ( j = start + 1; j <= end; ++j ) { + for ( j = i + 1; j <= end; ++j ) { if ( list[j] < list[minIndex] ) { minIndex = j; }