Implement Ex 2 isSorted and add some tests for it