struct list *p, *q, *s, *head;
p = head;
while(p != NULL)
{
if(x > p->data)
{
q = p;
p = p->next;
}
else
{
s = (struct list*)malloc(sizeof(struct list));
s->data = x;
q->next = s;
s->next = p;
}
}