|
|
вернуться в форумWhat should I output? If I have this input 3 2 3 3 4 5 4 Is there any difference between outputing 5 4 3 4 3 4 and 5 4 2 3 2 3 Yes. The author of the problem stresses that your program should output the same result as that you would get by using bubble sort - see the end of the problem text (or read this message) > If I have this input > 3 > 2 3 > 3 4 > 5 4 > > Is there any difference between outputing > 5 4 3 4 > 3 4 and 5 4 > 2 3 2 3 Bubble sort works following way: while (exists A[i] and A[i+1] such as A[i] < A[i+1]) do Swap(A[i], A[i+1]); So, the correct output is 3 4 5 4 2 3 |
|
|