🧮 选择排序 (Selection Sort)
难度 / Difficulty: 简单 (Easy)
分类 / Category: 排序 (Sorting)
时间复杂度 / Time Complexity: O(n²)
空间复杂度 / Space Complexity: O(1)
📖 算法简介 / Introduction
选择排序是一种简单直观的排序算法,每一轮从未排序部分选出最小(或最大)元素放到已排序部分。
Selection sort is a simple algorithm that repeatedly selects the minimum from the unsorted portion.
💡 算法原理 / Principle
每轮在未排序部分找到最小元素,与未排序部分的第一个元素交换。重复n-1轮后数组有序。
Find the minimum in the unsorted portion each round, swap it with the first unsorted element.
🎯 适用场景 / Scenarios
教学理解, 小规模数据排序, 空间受限场景
Educational purposes, Small datasets, Space-constrained scenarios
🔄 扩展阅读 / Further Reading
- 建议在 LeetCode 或 HackerRank 上刷相关题目
- 对比其他同类型算法的性能差异
- 理解算法背后的数据结构设计思想
| *本文由 AI 自动生成 | Generated by AI* |