Confused about a problem on exchanging an array

Jul 19, 2012 at 8:05pm
here is the question from my teacher, i'm not sure how to get started on this:

"Consider the following sort procedure written in pseudo code:

Exchange Sort of Array X[]

For I = 0 to (number of array elements - 2), increment by 1
For J = (I + 1) to (number of array elements - 1), increment by 1
If X[I] is greater than X[J] then
swap X[I] and X[J]
Next J
Next I

Implement the sort procedure in main() without using pointers.
Declare the array as follows using the test data shown:
int x[] = { 28, 87, -3, 45, 19 };
Use a for loop to print out the array before sorting and again after sorting."
Jul 19, 2012 at 8:13pm
Start with creating the array and iterate through it
Jul 19, 2012 at 8:30pm
It seems that this algorithm is the selection sort but with numerous swap operations.
Topic archived. No new replies allowed.