Ready to begin
No records have been processed. Start with Next step.

Follow one occurrence at a time. Choose another input to test empty lists, repeated IDs and different parameters.
Ready
No records have been processed. Start with Next step.
Predict the next change, then step through the list. The original course records remain unchanged.
L = the list of Mathematics marks
Ascending = true
while length(L) >= 2 AND Ascending:
if first(L) > first(rest(L)):
Ascending = false
else:
L = rest(L)
return AscendingAscending here means non-decreasing: every mark is less than or equal to the next. Equality is allowed. Compare a neighbour pair, then advance by ONE position. Advancing by two would skip the pair across the removed boundary. One decrease is enough to stop with false.
The original dataset order starts 68,62,57,… and is not sorted. The ascending option sorts all 30 Maths values for a successful comparison trace. A lecture-style short sequence deliberately contains 63,62 near the end to illustrate early failure; it is labelled as a teaching sequence rather than the original order.
An empty or singleton list has no violating adjacent pair, so this algorithm returns true. A full successful scan over n elements makes n−1 neighbour comparisons for n ≥ 1. We count these comparisons separately from the work done by helper functions such as length or rest.
Is [42,44,44,52] ascending under this rule?
Yes. Equal neighbouring values are allowed; this is non-decreasing order.
Why not compare every mark with every other mark?
For this order test, adjacent comparisons suffice: if each value is ≤ the next, the entire sequence is non-decreasing.
Does finding three correct neighbour pairs prove the rest of a long list is sorted?
No. Continue until all neighbours are checked or a decrease is found.