n be the minimum value in the list
m be the maximum value in the list

Have an array C[m-n]
Initialize C to zero.
now

Node *node=head;
while(node!=NULL)
{
         C[node->info-n]++;
}

now using the array C,create a sorted list.

Since we are using doubly linked list,we might have some other better
solution. I had this question in my Microsoft interview and the interviewer
was satisfied with this answer.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to