Advertisement
Guest User

Untitled

a guest
Jun 11th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fun sort [] = []
  2.         | sort [x] = [x]
  3.         | sort(x :: y :: ys) =
  4.             if (isOrdinata(x::y::ys) = false) then
  5.                 if x = min(x :: y :: ys) then [x] @ sort(y::ys)
  6.                 else if y = min(x :: y :: ys) then [y] @ sort(x::ys)
  7.                 else sort([y] @ [x] @ ys)
  8.             else
  9.                 (x :: y :: ys);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement