Blogz

The subtitle of your website

  • Home
  • About
  • Tags
  • Categories
  • Archives
  • Table of Contents
  • Overview
  1. 1. 排序算法 - 选择排序
    1. 1.1. 思路
    2. 1.2. 动图演示
    3. 1.3. 代码
Bob

Bob

The description of your website
33 posts
4 categories
15 tags
GitHub
0%

排序算法 - 选择排序

Posted on 2022-09-09 Edited on 2022-09-13 In SortAlgorithm

排序算法 - 选择排序


思路

动图演示

代码
1
2
3
4
5
6
7
8
9
public void sort(int[] arr) {
for (int i = 0; i < arr.length; i++) {
int n = i;
for (int j = i; j < arr.length; j++) {
if (arr[j] < arr[n]) n = j;
}
swap(arr, i, n);
}
}
# Sort
排序算法 - 希尔排序
排序算法 - 插入排序
© 2022 Bob
Powered by Hexo & NexT.Muse