Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fun sort [] = []
- | sort [x] = [x]
- | sort(x :: y :: ys) =
- if (isOrdinata(x::y::ys) = false) then
- if x = min(x :: y :: ys) then [x] @ sort(y::ys)
- else if y = min(x :: y :: ys) then [y] @ sort(x::ys)
- else sort([y] @ [x] @ ys)
- else
- (x :: y :: ys);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement