lua-users home
lua-l archive

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



On 16-08-25 08:58 PM, Coda Highland wrote:
> On Thu, Aug 25, 2016 at 4:53 PM, Phil Bewig <pbewig@gmail.com> wrote:
>> Heapsort, which I described above, doesn't need to know the length in
>> advance.
> 
> I believe the technicality is that it still has to have some notion of
> a stopping point before you can start taking elements out if you
> expect them to be in order.

Heapsort and insertion sort are similar in that they work on already
ordered part 1..m and adding new elements to keep that part ordered.

So if you are going to sort infinite sequence and want to see
intermediate results sorted - those are good algorithms. (Insertion sort
is simpler so almost any CS girl can implement it, heapsort is liked by
"old-school hackers" who like binary shifts and obscure and fast code.)