Generic quicksort library that can be used to sort an array having any data type (int, char *, struct key_value *, etc.).
Collin Funk
collin.funk1@gmail.com
Fri Sep 26 17:27:09 GMT 2025
Amit <amitchoudhary0523@gmail.com> writes:
> On Fri, Sep 26, 2025, 10:07 PM Collin Funk <collin.funk1@gmail.com> wrote:
>
>> Amit <amitchoudhary0523@gmail.com> writes:
>>
>> > This is misleading. It is mergesort. It should have been called msort().
>> >
>> > Then there is one more issue - if memory allocation fails then it does
>> > "heapsort".
>> >
>> > But no quicksort out there.
>>
>> There is no requirement that qsort uses quicksort. POSIX only requires
>> that it sorts the elements [1].
>>
>> Collin
>>
>> [1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/qsort.html
>
>
> This is fine with me. But then why name it qsort(). Why not call it sort().
>
> Anyways, anyone who sees qsort() will assume that it is quicksort.
>
> Anyways, there is no point in debating about the name of the function.
Because that is what the standard requires that the function is named.
Most users will care how it performs in the typical use case, not what
algorithm is used under the hood.
Collin
More information about the Libc-alpha
mailing list