[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Length-unaware sorting algorithm
- From: Coda Highland <chighland@...>
- Date: Fri, 26 Aug 2016 11:08:20 -0700
On Thu, Aug 25, 2016 at 6:39 PM, Soni L. <firstname.lastname@example.org> wrote:
> On 25/08/16 10:37 PM, Tim Hume wrote:
>> On Thu, 25 Aug 2016, Soni L. wrote:
>>> Heapsort assumes there is a length. Insertion sort is just bad, nowhere
>>> near quicksort, and it also iterates, effectively calculating a length.
>> Maybe you can describe the problem you are trying to solve with a bit more
>> context? That might make it easier to provide suggestions.
> I wanna sort a Lua table without a concept of length.
As has been mentioned: You're the developer; you know how to figure
out what data you need to care about. Any stream-based sort function
(insertion and heap have been named) is capable of sorting input data
without caring about how it's stored. Both algorithms are perfectly
happy to operate on unindexed linked lists if that's what you want to
do with them, and if it can do that it can handle anything you want to
throw at it.