Generic quicksort library that can be used to sort an array having any data type (int, char *, struct key_value *, etc.).
Amit
amitchoudhary0523@gmail.com
Sat Sep 27 04:06:15 GMT 2025
On Fri, 26 Sept 2025 at 22:27, Adhemerval Zanella Netto <
adhemerval.zanella@linaro.org> wrote:
>
>
> And taking the swap function from user is not necessary the best solution,
> for small elements the indirect function will most likely dominate. And
> it will require changing the ABI, which will require a new symbol.
>
>
Actually, we don't know what will be the size of the elements. It may be
small and it may be big also. So, sometimes the swap function will be
better and sometimes it will not.
So, in scenarios where no algorithm offers obvious advantages, I actually
choose the algorithm which is simpler to implement and understand. So, I
would still take the swap function from the user. The implementation will
be very simple and in future if someone else takes charge of the code then
he/she won't have to spend a lot of time to understand it.
----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20250927/7cfe5531/attachment.htm>
More information about the Libc-alpha
mailing list