How to prove if a list is sorted if any two consecutive elements are sorted?

68 Views Asked by At

To check if a list is sorted, a typical approach is to check every element and its next element, and see if they are sorted. Intuitively, I understand it is correct. But is there a more mathematical or rigorous way to prove this? Thanks