Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,10 @@
|
|||
defmodule Sort do
|
||||
def gnome_sort([]), do: []
|
||||
def gnome_sort([h|t]), do: gnome_sort([h], t)
|
||||
|
||||
defp gnome_sort(list, []), do: list
|
||||
defp gnome_sort([prev|p], [next|n]) when next > prev, do: gnome_sort(p, [next,prev|n])
|
||||
defp gnome_sort(p, [next|n]), do: gnome_sort([next|p], n)
|
||||
end
|
||||
|
||||
IO.inspect Sort.gnome_sort([8,3,9,1,3,2,6])
|
||||
Loading…
Add table
Add a link
Reference in a new issue