- The output is in a non decreasing order.
- The output is a reordering of the input.
Pseudo-code
Begin
Repeat five times
Repeat five times
Prompt user for number
End repeat
Take first number
if
number is smaller than number to the right leave it.
else
switch with the first number to that right that is smaller.
End if
End
So I didn't really know what you expected but I worded the process out as best as I could.
Take first number
if
number is smaller than number to the right leave it.
else
switch with the first number to that right that is smaller.
End if
End
So I didn't really know what you expected but I worded the process out as best as I could.
Will your algorithm terminate?
ReplyDeleteWill it produce the right result?