Bubble sort algorithm
Two-layer loop, bubbling on the outer layer
Algorithm details
- Compare two adjacent elements in the array, if the former is greater than the latter, exchange positions
- Each comparison will produce a maximum or minimum value
- The next round can be sorted one less time
- Loop until the end
Sparse array
Processing method
- How many rows and columns in the record array, and how many different values
- Record the elements, ranks and values with different values in a small-scale array, thereby reducing the size of the array
(Quoted from "The Mad God Says")