TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Sorting functions implemented in C as std qsort() format

41 点作者 adembudak超过 7 年前

4 条评论

beeforpork超过 7 年前
The overview table should list some important properties I find myself comparing when selecting a sort algo: (a) stack usage, (b) heap usage, (c) whether the algo is stable.<p>E.g., I am a big fan of heap sort, because the implementation is very simple, and non-recursive (O(1) stack), uses no heap, and has worst-case time O(log n). It is almost perfect, but it is not stable. Now, mergesort fixes that stability issue (and its implementation is usually also very simple), but is often recursive (like this implementation) and it usually requires &#x27;malloc()&#x27;, because it cannot easily be run in-place. In an overview list, this dilemma would be nicely visible.
rambojazz超过 7 年前
Repo has no license.
评论 #16011987 未加载
评论 #16015086 未加载
评论 #16012801 未加载
rurban超过 7 年前
I wonder why the better sorting algos are never compared, like for small integer indices counting sort is linear, for larger indices radix sort is optimal and for parallel sorting there exist also special variants.
xiii1408超过 7 年前
Very cool! The function pointers bother me a bit, but hey, I&#x27;m a C++ programmer, and maybe link-time optimization is there now.
评论 #16014766 未加载