September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
|
|
@ -1,11 +1,11 @@
|
|||
defmodule Sort do
|
||||
def bsort(list) when is_list(list) do
|
||||
t = bsort_move(list)
|
||||
t = bsort_iter(list)
|
||||
|
||||
if t == list do t else bsort(t) end
|
||||
if t == list, do: t, else: bsort(t)
|
||||
end
|
||||
|
||||
def bsort_move([x, y | t]) when x > y, do: [y | bsort_move([x | t])]
|
||||
def bsort_move([x, y | t]), do: [x | bsort_move([y | t])]
|
||||
def bsort_move(list), do: list
|
||||
def bsort_iter([x, y | t]) when x > y, do: [y | bsort_iter([x | t])]
|
||||
def bsort_iter([x, y | t]), do: [x | bsort_iter([y | t])]
|
||||
def bsort_iter(list), do: list
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue