#define NULL 0
#include<stdio.h>
/*#include<iostream.h>*/
#define max 11
typedef struct  list
{
    int elem[max];
    int length;
}stb1;
stb1 * halfsort(stbl *s)
{
    int i,low,high,mid;
    for(i=2;i<s->length;i++)
    {
        s->elem[0]=s->elem[i];
        low=1;
        high=i-1;
        while(low<=high)
        {
          mid=(low+high)/2;
          if(s->elem[0]>s->elem[mid])
              low=mid+1;
          else
              high=mid-1;
        }
        for(j=s->length;j>=high+1;j--)
        s->elem[j+1]=s->elem[j];
        s->elem[high+1]=s->elem[0];
    }
    return s;
}
main()
{
    stbl s,*p=NULL;
    s->elem[11]={12,30,78,55,43,99,87,76,33,2};
    s->length=11;
    p=halfsort(&s);
         for(i=0;i<max;i++)
           printf("%d",p->elem[i]);

}