Principle analysis:

Compare two adjacent values in turn and, if the latter is smaller, swap their order.






Principle analysis:

Pick the smallest value in turn and place it in the array.






Principle analysis:

Compare the current value to the sorted value, find the right place for the current value in the previously sorted array, and insert it.




Links:

https://juejin.cn/post/6844903444365443080