跳到主要内容

资源 · 指南或文章

Merge Sort

把归并排序作为一种稳定的分治算法来讲解,并配有自顶向下的递归示例。

审核日期

打开原站: Merge Sort (在新标签页中打开原网站)

添加到路线图

把这个资源放进你正在跟进的路线图。它会作为你自己的补充资源显示;路线图的步骤不会改变,也不计入你已记录的步骤。

来源内容语言:英语

Read this in other languages: 한국어, Português In computer science, merge sort (also commonly spelled mergesort) is an efficient, general-purpose, comparison-based sorting algorithm. Most implementations produce a stable sort, which means that the implementation preserves the input order of equal elements in the sorted output. Mergesort is a divide and conquer algorithm that was invented by John von Neumann in 1945. An example of merge sort. First divide the list into the smallest unit (1 element), then compare each element with the adjacent list to sort and merge the two adjacent lists. Finally all the elements are sorted and merged.

PrepKit 概览

本概览由 PrepKit 编辑根据源代码仓库撰写并审核,并非资源本身的文字。

适合人群
来源未说明适用级别
形式
参考资料

涵盖内容

  • 拆分到单个元素,再合并相邻的列表。
  • 以七个整数为例的递归示意图。
  • 复杂度表:所有情况下均为 n log(n),内存 n,稳定。

使用建议

这是 PrepKit 的学习建议,并非来源的说法。

编写自顶向下的归并排序,在七个值的示例上追踪执行过程,并解释 n 的内存用在了哪里。

范围与局限

内容简短;没有自底向上的变体,也没有练习。链接到维基百科和 YouTube。附有韩文和葡萄牙文版本的链接。

获取方式与形式

GitHub 上的英文 README(采用 MIT 许可的 trekhleb/javascript-algorithms),免费。

PrepKit 于 2026年10月2日 审核。 资源来源提交: 85293e3e2b88

本概览的依据
  • src/algorithms/sorting/merge-sort/README.md

收录此条目的页面

订阅 PrepKit 通讯

可选。使用 PrepKit 并不需要订阅。

我们如何处理你的邮箱