Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Write an algorithm to sort the elements A[0]~A[n- 1] in the plastic array A[n].
Write an algorithm to sort the elements A[0]~A[n- 1] in the plastic array A[n].
Invalid? SelectSort(int? A[],int? n)

{

int? Ryan. =? sizeof(A)/sizeof(int);

int? startPos? =? 0;

int? endPos? =? Ryan. -? 1;

int? minPos? =? 0,? maxPos? =? 0;

int? Temporary workers? =? 0;

What time? (startPos? & gt=? End position)

{

minPos? =? maxPos? =? startPos

//Find out where the minimum and maximum values are in the interval from startPos to endPos.

For what? (int? I = startPos me<= endPosi++)

{

What if? (a [me]? & lt? A [minPos])

{

minPos? =? Me;

}

Or what? What if? (a [me]? & gt? One [maximum position])

{

maxPos? =? Me;

}

}

//Put the minimum value in the startPos position.

Temporary workers? =? a[min pos];

A [minPos]? =? a[start pos];

A [startPos]? =? Temperature;

//put the maximum value at the endPos position.

Temporary workers? =? a[min pos];

A [minPos]? =? a[start pos];

A [startPos]? =? Temperature;

//Move the maximum value and the minimum value out of the sorting interval to perform the next sorting.

startpos++;

end pos-;

}

}