aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKuan-Wei Chiu <[email protected]>2024-05-28 04:30:09 +0800
committerAndrew Morton <[email protected]>2024-06-24 22:25:02 -0700
commitf49ac9571b8f1de4dfcce941a936a4d19dd7bb8a (patch)
tree561c682f95b78cb409257ec76aa217e0bfce7490
parent85fb11a87921a017e5551835eaaf58f9da173686 (diff)
lib/sort: fix outdated comment regarding glibc qsort()
The existing comment in lib/sort refers to glibc qsort() using quicksort. However, glibc qsort() no longer uses quicksort; it now uses mergesort and falls back to heapsort if memory allocation for mergesort fails. This makes the comment outdated and incorrect. Update the comment to refer to quicksort in general rather than glibc's implementation to provide accurate information about the comparisons and trade-offs without implying an outdated implementation. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Kuan-Wei Chiu <[email protected]> Cc: Ching-Chun (Jim) Huang <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
-rw-r--r--lib/sort.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sort.c b/lib/sort.c
index 651b73205f6d..b918ae15302d 100644
--- a/lib/sort.c
+++ b/lib/sort.c
@@ -5,7 +5,7 @@
* This performs n*log2(n) + 0.37*n + o(n) comparisons on average,
* and 1.5*n*log2(n) + O(n) in the (very contrived) worst case.
*
- * Glibc qsort() manages n*log2(n) - 1.26*n for random inputs (1.63*n
+ * Quicksort manages n*log2(n) - 1.26*n for random inputs (1.63*n
* better) at the expense of stack usage and much larger code to avoid
* quicksort's O(n^2) worst case.
*/