Re: In case anyones interested:)

From: Mark Roberts (mu@manumark.de)
Date: Wed Nov 29 2000 - 01:27:36 CET


On Tue, 28 Nov 2000, Jochen Cichon wrote:

> > The "ps" currently in muLinux (not the fake, the real) do not
> > support the switch --sort, because old (the ps, not the switch).
> OK
>
> In that case. There is no sorted list :)
>
> Joschi
> (BTW:.. if i found some time, i do an awk sort for that :/ )

Oh no, not awk! Unless you're very careful, it will be very slow, of the
order of n^2, ... unless you can get awk to store all the data in an array
and sort in memory. As soon as you need two passes, time will be n^2 for
outputting the lines in the correct order.

But maybe, with an array ... Can you do arrays in awk? Can awk do
recursion? In that case, why not implement quicksort, or heapsort, or
mergesort. ... I looked in the manpage: awk CAN do recursion, so no
problem there. So forget all I said about n^2.

Have we no 'sort' in mu? I have one here:

GNU sort 1.22, size 22760 bytes

and it can do EVERYTHING, as you will have guessed. The idea of mergesort
implemented in awk is intriguing ...

Mark Roberts

---------------------------------------------------------------------
To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.auc.dk
For additional commands, e-mail: mulinux-help@sunsite.auc.dk



This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:17 CET