Direct-inclusion sorting
<p>What is the other name for direct-inclusion sorting and what is the algorithm for the same sort?</p>

<p>I have been trying to search on the Internet, but I'm not getting a straight answer, but I can not find any. I found this algorithm for straight insertion sort and in some books it's saying they are the same with direct direct-inclusion sorting, but I'm doubting it because the book is in Russian, so I want to confirm (that is, if it's true or might I have a translation error?)</p>

<p>Code in C++:</p>

<pre><code>int main(int argc, char* argv[])
{
    int arr[8] = {27, 412, 71, 81, 59, 14, 273, 87},i,j;

    for (j=1; j&lt;8; j++){
        if (arr[j] &lt; arr[j-1]) {
            //Что бы значение j мы не меняли а работали с i
            i = j;
            //Меняем местами пока не найдем нужное место
            do{
                swap(arr[i],arr[i-1]);
                i--;
                //защита от выхода за пределы массива
                if (i == 0)
                    break;
            }
            while (arr[i] &lt; arr[i-1]) ;
        }
        for (i=0;i&lt;8;i++)
            cout &lt;&lt; arr[i]&lt;&lt; ' ';
        cout &lt;&lt; '\n';
    }
    getch();
    return 0;
}
</code></pre>

<h3>Result</h3>

<pre><code>27 412 71 81 59 14 273 87
27 71 412 81 59 14 273 87
27 71 81 412 59 14 273 87
27 59 71 81 412 14 273 87
14 27 59 71 81 412 273 87
14 27 59 71 81 273 412 87
14 27 59 71 81 87 273 412
</code></pre>
