Determine the "worst-case" runtime for the following sorting algorithm written in this code?
1 sort (array a) { 2 for (n=a.size; n>1; --n) { 3 for (i=0; i<n-1; ++i) { 4 if (a[i] > a[i+1]) { 5 a.swap(i, i+1) 6 } 7 } 8 } 9 }
Determine the worst-case runtime:
O(n2) O(1) O(n*log(n)) O(n)
which option determine the worst-case runtime for the following sorting algorithm written in this code?
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)