Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,8 @@
|
|||
-module(sort).
|
||||
-export([insertion/1]).
|
||||
|
||||
insertion(L) -> lists:foldl(fun insert/2, [], L).
|
||||
|
||||
insert(X,[]) -> [X];
|
||||
insert(X,L=[H|_]) when X =< H -> [X|L];
|
||||
insert(X,[H|T]) -> [H|insert(X, T)].
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
1> c(sort).
|
||||
{ok,sort}
|
||||
2> sort:insertion([5,3,9,4,1,6,8,2,7]).
|
||||
[1,2,3,4,5,6,7,8,9]
|
||||
Loading…
Add table
Add a link
Reference in a new issue