Skip to content
Snippets Groups Projects
Commit 5da81995 authored by Okko Ailio's avatar Okko Ailio
Browse files

v1.1, quick (temporary) fix

parent f143dae1
No related branches found
No related tags found
No related merge requests found
Pipeline #49945 passed
...@@ -19,5 +19,14 @@ public class Bubblesort { ...@@ -19,5 +19,14 @@ public class Bubblesort {
} }
} }
} }
//If last element is smaller than the second last one
//TEMPORARY SOLUTION
if(array[len-2] > array[len-1]){
memory = array[len-2];
//Put the smaller element in the smaller index
array[len-2] = array[len-1];
//Insert the greater value to its new index from the memory-variable
array[len-1] = memory;
}
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment