Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def insertionSortFoldLeft[A <% Ordered[A]](list: List[A]): List[A] ={
- list.foldLeft(List.empty[A]){(r,e) => val (first, last) = r.span(_ < e)
- first ::: e :: last
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement