HypnotiC
September 30th, 2004, 05:29 AM
Hi every one ...
plz can any one help with finding the big-Oh characterizations in terms of n, of the running time for the following method
void SelectionSort( int[] A ) {
int Minposition, temp, I, J;
for( I = n-1; I > 0; --I ) {
Minposition = I;
for( J = 0; J < I; ++J ) {
if( A[J] < A[ Minposition ] )
Minposition = J;
}
temp = A[I];
A[I] = A[ Minposition ];
A[ Minposition ] = temp;
}
}
plz can any one help with finding the big-Oh characterizations in terms of n, of the running time for the following method
void SelectionSort( int[] A ) {
int Minposition, temp, I, J;
for( I = n-1; I > 0; --I ) {
Minposition = I;
for( J = 0; J < I; ++J ) {
if( A[J] < A[ Minposition ] )
Minposition = J;
}
temp = A[I];
A[I] = A[ Minposition ];
A[ Minposition ] = temp;
}
}