V2EX  ›  英汉词典
Enqueued related words: Binary Heap, Heapify, Selection Sort

Heapsort

定义 Definition

堆排序:一种比较排序算法,先把数据组织成(通常是最大堆),然后反复取出堆顶元素并调整堆,从而得到有序序列。它的典型时间复杂度是 O(n log n),并且可以原地排序(只需常数级额外空间),但通常不稳定。(此外也有小根堆版本,用于升/降序的不同实现。)

例句 Examples

Heapsort runs in O(n log n) time.
堆排序的时间复杂度是 O(n log n)。

Although quicksort is often faster in practice, heapsort guarantees O(n log n) even in the worst case by repeatedly heapifying after extracting the maximum.
尽管快速排序在实践中常常更快,但堆排序通过每次取出最大值后重新调整堆,能在最坏情况下也保证 O(n log n)。

发音 Pronunciation (IPA)

/ˈhiːpˌsɔːrt/

词源 Etymology

heapsort 是由 heap(堆) + sort(排序) 构成的复合词,字面意思就是“用堆来进行排序”。其中 heap 在计算机科学里指“堆这种数据结构”(常见为二叉堆),用于高效地获取最大/最小元素;sort 则表示将元素按一定顺序排列。

相关词 Related Words

文学与著作中的用例 Literary Works

  • Introduction to Algorithms(《算法导论》, Cormen/Leiserson/Rivest/Stein):在排序章节中系统介绍堆与堆排序(Heapsort)。
  • The Art of Computer Programming, Volume 3: Sorting and Searching(Knuth,《计算机程序设计艺术》第3卷《排序与查找》):讨论多种排序方法及其分析,涉及堆与相关排序思想。
  • Algorithms(Sedgewick & Wayne,《算法》):以实现与性能分析的方式讲解堆排序及其与优先队列的关系。
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   901 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 18ms · UTC 23:27 · PVG 07:27 · LAX 15:27 · JFK 18:27
♥ Do have faith in what you're doing.