Node *MoveMinToStart(Node *aHead)
{
if(aHead == NULL or aHead->next == NULL)
return aHead;
Node *PrevMin = NULL,*Cur=aHead,*Prev=NULL,*Min=NULL;
while(Cur){
if(Min == NULL or Min->Value > Cur->Value){
Min = Cur;
PrevMin = Prev;
}
Prev = Cur;
Cur = Cur->next;
}
if(PrevMin == NULL)
Sort linked list
October 6th, 2006 · No Comments · Algorithms
Tags:
















0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment