[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Memory use of sort!
Aubrey Jaffer skrev:
| Date: Tue, 07 Nov 2006 13:52:04 +0100
| From: =?ISO-8859-1?Q?Jens_Axel_S=F8gaard?= <email@example.com>
| The specification of sort! reads:
| Function: sort! sequence less?
| Function: sort! sequence less? key
| Returns list, array, vector, or string sequence which has
| been mutated to order its elements according to less?. Given
| valid arguments, it is always the case that:
| (sorted? (sort! sequence less?) less?) => #t
| Would be possible to add that the sorting is in-place?
Just before the specification of SORTED? is:
The `!' variants sort in place; sort! returns its sequence argument.
I missed that.
> | Date: Sun, 12 Nov 2006 16:06:59 -0800
> | From: Per Bothner <firstname.lastname@example.org>
> | Aubrey Jaffer wrote:
> | > http://en.wikipedia.org/wiki/Sorting_algorithm has a table of
> | > properties for sort algorithms. "In-place merge sort" is shown as
> | > stable, O(n log(n)) time, and using no additional memory.
I meant "using no additional memory", when I wrote "in-place".
> | "In-place merge sort" works well for lists. Is there an in-place
> | version for vectors?
> I think
> gives one.
> I am saturated with work now. Anyone up for coding it?
Can't this be used?
Jens Axel Søgaard