Insert ordering algorithm

xiaoxiao2021-03-06  26

Insert ordering algorithm

Thoughts see the sorting process as the sequence of single orderly expansion into the overall ordered process, that is, first sequence the second element compared to the first element, insert it into a suitable position, and then the third element with the first two The element is compared to insert it into a suitable position, so that the n-1 element is compared and inserted into the appropriate position until finally the n-1 element is compared to the previous N-1 element. Algorithm / * * Creation Date 2004-12-14 * * * /

/ ** * Insert Sort * * @Author Wubai * * / Public Class InsertSort {

/ ** * Insert Sediment * * @Param INTARR To sort the array * @return Sort Array * / public int [] insertsort (int [] INTARR) {int x; // To make comparison elements, from the second The beginning of the J element before INT j; // x, the array subscript, is also the last number of positions // to be more than the number of times (all elements, the sum -1) for (int i = 1; i = 0 && x

转载请注明原文地址:https://www.9cbs.com/read-79390.html

New Post(0)