跳到主要内容

资源 · 指南或文章

Selection Sort

选择排序概要:一种原地比较排序,写起来简单,在大列表上很慢。

审核日期

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

添加到路线图

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

来源内容语言:英语

Read this in other languages: Português. Selection sort is a sorting algorithm, specifically an in-place comparison sort. It has O(n2) time complexity, making it inefficient on large lists, and generally performs worse than the similar insertion sort. Selection sort is noted for its simplicity, and it has performance advantages over more complicated algorithms in certain situations, particularly where auxiliary memory is limited.

PrepKit 概览

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

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

涵盖内容

  • 定位:总体上不如插入排序,但在辅助内存受限时有一定优势。
  • 复杂度表:所有情况下均为 n 的平方,内存 1,不稳定。

使用建议

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

写出选择排序,并用一个含相等键的小例子解释它为什么不稳定。

范围与局限

非常简短;过程只通过动画展示,只有一个维基百科链接。附有葡萄牙文版本的链接。

获取方式与形式

GitHub 上 trekhleb/javascript-algorithms 中的免费英文 README,MIT 许可。

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

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

收录此条目的页面

订阅 PrepKit 通讯

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

我们如何处理你的邮箱