This small log, simple oh tidy up under the direct insertion sort, refer to eight sorting algorithms and degrees Niang direct insertion sort.
Eight of the sorting algorithm is better organized, here copy part of the explanation as their own records. Insert a record into the sorted ordered table to get a new, sequential table with a 1 increase in the number of records.
The source of the reference to the two articles, but in order to streamline the code to find the original code can also be optimized, the code of their own to organize the following:
    //time complexity is O (n^2)//space Complexity of O (1)//Direct Insert Sort: Inserts a record into a sorted ordered table to get a new, sequential table with a 1 increase in the number of recordstemplate< TypeName T >inlinevoidInsertsort (T a[],intN) {inti,j,t;  for(i =1;i< N; + +i) {t=A[i]; J= I1;  while(t<A[j]) {A[j+1]=A[j]; --J; } a[j+1] =T; }    }
C + + algorithm-Direct Insert sort