Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void test(ll *a, ll *sorted, int n) {
- ll *checked = (ll *) calloc(n, sizeof(ll));
- int found = 0;
- for (int i = 0; i < n; ++i) {
- for (int j = 0; j < n; ++j) {
- if (sorted[i] == a[j]) {
- if (checked[j] == 0) {
- checked[j] = 1;
- found = 1;
- break;
- }
- }
- }
- if (found == 0)
- printf("Элементы отсортированного массива не совпадают с элементами изначального массива");
- else
- found = 0;
- }
- for (int i = 1; i < n; ++i) {
- if (sorted[i] < sorted[i - 1]) {
- printf("Элементы отсортированы в неправильном порядке\n");
- }
- }
- for (int i = 0; i < n; ++i) {
- if (!checked[i])
- printf("Элементы отсортированного массива не совпадают с элементами изначального массива");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement