From d86d72e2908794bf5a079f3fb315922203a3a731 Mon Sep 17 00:00:00 2001 From: KhoDongwook Date: Thu, 31 Mar 2022 15:18:02 +0900 Subject: [PATCH 1/2] edit --- main.cpp | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/main.cpp b/main.cpp index 39d17e2..af77b66 100644 --- a/main.cpp +++ b/main.cpp @@ -141,7 +141,13 @@ void bubble_sort_descending(int* array, unsigned int size) { for (unsigned int i = 0; i < size - 1; i++) { //####################################################### - //Implement here + for (unsigned int j=0; jmax_val){ + max_index = j; + max_val = array[j]; + } + } + swap(array[i], array[max+index]); + //###################################################### } } - From 9de74948ec04776bac693f9bd7686a83aa48f361 Mon Sep 17 00:00:00 2001 From: KhoDongwook Date: Thu, 31 Mar 2022 15:20:36 +0900 Subject: [PATCH 2/2] edit2 --- main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index af77b66..7a342cf 100644 --- a/main.cpp +++ b/main.cpp @@ -184,7 +184,7 @@ void selection_sort_descending(int* array, unsigned int size) { max_val = array[j]; } } - swap(array[i], array[max+index]); + swap(array[i], array[max_index]); //###################################################### } }