Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def isSorted[A](as: Array[A], ordered: (A,A) => Boolean): Boolean ={
- @annotation.tailrec
- def go(n: Int):Boolean=
- if(n == as.length -1) true
- else if (ordered(as(n), as(n+1))) false
- else go(n + 1)
- go(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement