Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,16 @@ void bubble_sort_descending(int* array, unsigned int size) {
{
//#######################################################
//Implement here
;
for (unsigned int j = 0; j < size - 1 - i; j++)
{
if (array[j] < array[j+1])
{
int temp;
temp = array[j];
array[j] = array[j+1];
array[j+1] = temp;
}
}
//#######################################################
}
}
Expand All @@ -152,7 +161,16 @@ void insertion_sort_descending(int* array, unsigned int size) {
{
//#######################################################
//Implement here
;
int temp = array[i];
int j = i-1;
while(1)
{
if (j<0) break;
if (array[j] >= temp) break;
array[j+1] = array[j];
j--;
}
array[j+1] = temp;
//#######################################################
}
}
Expand All @@ -162,7 +180,16 @@ void selection_sort_descending(int* array, unsigned int size) {
{
//#######################################################
//Implement here
;
int temp = array[i];
int j = i-1;
while(1)
{
if (j<0) break;
if (array[j] >= temp) break;
array[j+1] = array[j];
j--;
}
array[j+1] = temp;
//#######################################################
}
}
Expand Down