
常用排序算法
a person~~
I am a person
展开
-
<two>Insertion sort
Inserttion sort It is a simple sorting algorithm that work simliar to the way you sort palying cards in your hand. split into sorted and an unsorted pat pick 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 · 117 阅读 · 0 评论 -
<two>Selection Sort
Core idea: each find max number,put it in unused postion Introduce loop : A find a number i and i is max number in array. swap i and n. then n=n-1 repeat A until n ==0 Code private static void selectSort(int[] a) { for (int i = 0;...原创 2022-05-14 20:32:09 · 149 阅读 · 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 · 103 阅读 · 0 评论