![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
常用排序算法
a person~~
I am a person
展开
-
<two>Insertion sort
Inserttion sortIt is a simple sorting algorithm that work simliar to the way you sort palying cards in your hand. split into sorted and an unsorted patpick a number N, compare (n~1,and n-1 has sorted.), if n < (n-1), index[n] <n-1. and n-1 compa原创 2022-05-17 15:14:52 · 92 阅读 · 0 评论 -
<two>Selection Sort
Core idea:each find max number,put it in unused postionIntroduceloop : Afind a number i and i is max number in array. swap i and n. then n=n-1repeat A until n ==0Code private static void selectSort(int[] a) { for (int i = 0;...原创 2022-05-14 20:32:09 · 121 阅读 · 0 评论 -
<one>Bubble sort
Bubble sort core idea: a stability sorting algorithm .find a max number and put it in last position by compare.Introduce: Begain A: starting from the first index , compare the first and the second.if the first greater than ...原创 2022-05-13 21:45:52 · 82 阅读 · 0 评论