What are the eight sorts that Java programmers must know?
Java programmers must know what the top 8 order is, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
The relationship between 8 kinds of sorting:
1, insert the sort directly
(1) basic idea: in a set of numbers to be sorted, it is assumed that the previous number (nmur1) [n > = 2] is already ranked.
In good order, now we need to insert the nth number into the previous ordered number, so that the n number
It's in order, too. Cycle again and again until they are all in order.
(2) examples
(3) implement with java
Package com.njue; public class insertSort {public insertSort () {inta [] = {49 public insertSort () {inta [] = {49, 358, 1327, 279, 74, 34, 12, 4, 5, 4, 4, 4, 4, 5, 4, 18, 18, 23, 23, 3, 15, 35, 35, 25, 53, 51); int temp=0; for (int item1, alternate itempl, leading itemp.