# Size 10
// Insert the sorting directly
Void insert_sort (){
Int I, J;
Int array [size + 1];
Array [] = {, 22 };
For (I = 2; I <= size; I ++ ){
Array [0] = array [I];
J = I-1;
While (array [0] <array [J]) {
Array [J + 1] = array [J];
J --;
}
Array [J + 1] = array [0];
}
}
// Semi-insert sorting
Void insert_binary_sort (){
Int J, I, low, hight, M;
Int array [size + 1];
For (I = 2; I <= size; I ++ ){
Array [0] = array [I];
Hight = I-1;
Low = 1;
While (low <= hight)
{
M = (low + hight)/2;
If (array [0] <array [m])
Hight = m-1;
Else low = m + 1;
}
For (j = I; j> hight + 1; j --)
{
Array [J] = array [J-1];
}
Array [hight + 1] = array [0];
}
}
// Shell sorting, optimized by direct insertion sorting
Void shell_sort (){
Int d, n, J, I;
Int array [size + 1];
Int d = N;
Do {
D = D/2;
For (I = d + 1; I <= size; I ++)
{
Array [0] = array [I];
For (j = I-d; j> 0 & array [J]> array [0]; j-= d ){
Array [J + D] = array [J];
}
Array [J + D] = array [0];
}
} While (D! = 1 );
}
Shell sorting of data structures