Consider the obvious algorithm for checking whether a list of integers is sorted: start at the beginning of the list, and scan along until we first find a successive pair of elements that is out of order. In that case, return false. If no such pair is found by the time we reach the end of the list, return true.
suppose that the input list is a random permutation of 1,2,3……,n and all such permutations are equally likely. Derive the average-case expeted running time. give both an exact and asymptotic answer.