InsertNode(NODE **q,int num)
{
NODE *r,*temp ;
temp = *q;
r= malloc(sizeof(NODE));
r->data = num;
//if it's fisrt node to be inserted
if ( *q == NULL num < (*q)->data)
{
*q = r ;
(*q)->link=temp;
}
else
{
while(temp)
{
if ( (num > temp->data) && (num < temp->link->data ) )
{
r->link = temp->link;
temp->link = r;
return;
}
temp = temp->link;
}
r->link = NULL;
temp->link = r;
}
}
Copyright © 2026 eLLeNow.com All Rights Reserved.