data-structures · beginner · ~15 min
Verify an ordering invariant.
Implement int is_sorted(const int *a, int n) returning 1 if the array is non-decreasing, else 0.
int is_sorted(const int *a, int n) {
/* TODO */
return 1;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.