guys this is what I've done so far:
Code:
Node *MakeSortedList(Node *list)
{
//declarations of variables.
Node *sorted_list = NULL;
Node *temp_node = CreateNode(0,1);
int i = 0;
//allocating memory for the node.
temp_node = (Node *) malloc( sizeof( Node ) );
//loop over the list
for( i = 0; i < 100; i++ )
{
while( list->next != NULL )
{
if( list->value > list->next->value )
{
temp_node = CreateNode(list->value,1);
}
list = list->next;
}
sorted_list = InsertAtBeg(temp_node,list);
}
return sorted_list;
}