Three commonly used sorting theories

bubble sort

Compare two adjacent numbers each time

small swap to front

At the end of each round, the largest number is exchanged to the end

bubble

direct insertion sort

The number to be inserted is X, first determine the position P where X is inserted in the array

, the elements after P in the array are moved back one position, emptying A(p), and putting x into A(P).

insert

selection sort

Each time selects the record with the smallest keyword among the N records as the lth record of the ordered sequence, and sets l to be 1-N-1, and performs N-1 selection operations.

choose

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325387592&siteId=291194637