Sat Mar 4 00:16:52 CET 2006
I briefly looked at the wiki pedia insertion sort algorithm (honestly, it
was pseudo code :-P ) and I think this code also works, too.
Only difference is that I compare value from the beginning not from the end
in the inner loop.
insert(Value, [H|T]) when Value >= H -> [H|insert(Value, T)];
insert(Value, T) -> [Value|T].
insert_sort(A) -> insert_sort(A, ).
insert_sort(, Acc) -> Acc;
insert_sort([Value|T], Acc) -> insert_sort(T, insert(Value, Acc)).
On 3/3/06, chandru <chandrashekhar.mullaparthi@REDACTED> wrote:
> On 03/03/06, Peter Marks <peter.c.marks@REDACTED> wrote:
> > This article at LTU talks about a new Literate Programming (Knuth)
> > http://lambda-the-ultimate.org/node/1336
> > I went there and they have a category for Erlang, but no programs yet!
> There is one now. I've added an implementation of insertion sort. But
> I created a subcategory in the process instead of adding an article.
> If anyone knows how to fix it, please do.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions