How to check the ordering of an array sorted by the bubble method?
Closed due to the fact that it was off topic by participants aleksandr barakin , Cheg , KAGG Design , AK ♦ , rdorn 24 Sep '17 at 13:00 .
It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:
- "The message contains only the text of the task, in which there is no description of the problem, or the question is purely formal (" how do I do this task ") . To reopen the question, add a description of the specific problem, explain what does not work, what you see the problem. " - Cheg, KAGG Design, AK, rdorn
- Add a code to the question. - 0xdb
- A bubble is a sorting algorithm, not an ordering check. To check the orderliness of the array, it is enough to go through it once - Andrew NOP
- oneChecking the order does not depend on what method the array was ordered, and whether it was ordered at all. - Akina
- oneThe question from which side look bad. And home, and the absence of code, and incomplete data in question (an array of strings or numbers). Voted for closing. - AK ♦
|
1 answer
Speech about it?
char massiv[n]; int i = 0; for (i;i < n;i++) { if (massiv[i] > massiv[i + 1]) { puts("не отсортировано!"); break; } } - i <n - 1 otherwise there will be going beyond the massiv massif [i + 1] - Andriy Martsinkevych
- @Andriy Martsinkevych, right) I just quickly dashed off an example. - LokenGarvel '
|