Kody źródłowe/Sortowanie przez wstawianie: Różnice pomiędzy wersjami
Usunięta treść Dodana treść
m →PHP: Dodano wcięcia w kodzie |
ocaml |
||
Linia 65:
std::iter_swap((j - 1), j);
}
</source>
== Ocaml ==
<source lang="ocaml">
let rec insertsort list =
let rec insert element list =
match list with
| [] -> [element]
| (h :: t) ->
if element > h then h :: (insert element t)
else element :: h :: t
in
match list with
| [] -> []
| h :: t -> insert h (insertsort t)
</source>
|