From f89321a8f1f9049cd867c37f4e5ff2209b5e602d Mon Sep 17 00:00:00 2001 From: Lajat5 Date: Thu, 21 Oct 2021 17:31:37 +0000 Subject: [PATCH] Reworked on changes. --- sorting/selection_sort_iterative.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sorting/selection_sort_iterative.cpp b/sorting/selection_sort_iterative.cpp index 90caeed48..8d9f94edd 100644 --- a/sorting/selection_sort_iterative.cpp +++ b/sorting/selection_sort_iterative.cpp @@ -46,7 +46,7 @@ namespace sorting { template void selectionSort(std::vector &arr, uint64_t len) { for (uint64_t it = 0; it < len; ++it) { - int64_t min = it; // set min value + uint64_t min = it; // set min value for (uint64_t it2 = it + 1; it2 < len + 1; ++it2) { if (arr[it2] < arr[min]) { // check which element is smaller min = it2; // store index of smallest element to min @@ -54,7 +54,7 @@ void selectionSort(std::vector &arr, uint64_t len) { } if (min != it) { // swap if min does not match to i - int64_t tmp = arr[min]; + uint64_t tmp = arr[min]; arr[min] = arr[it]; arr[it] = tmp; }