摘要:
2.2-1:O(n^3)2.2-2:Selection-Sort(A): for( i=0 ; i<A.size()-1 ; i++){ max = A[i]; index = 0; for(j=i+1; j<A.size(); j++){ if(max < A[j]){ max = A[j]; index = j; } } // then swap the next max and the current element A[j] = A[i]; A[i] = max; }2.2-3:Say we're sorting nelementsWorst Case: nB 阅读全文