Hi,all,let's take a few minutes to write this Insert Sort algorithm down,the ideas is:definition a guard to store the original sorted array in this guard,assume the first num in the sorting data array is sorted,then guard loop to the end of this array,every per loop we will insert the new num to the sorted array and make the new array sorted,in the end the whole array is sorted,that's all.
the algorithm as follow:
and there is another algorithm as follow:this one is familiar with the up one.
easy,simply.
over.