lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Aug 25, 2016 at 6:39 PM, Soni L. <fakedme@gmail.com> 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.
>>
>> Cheers,
>>
>> Tim.
>>
>
> 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.

/s/ Adam