Click to See Complete Forum and Search --> : MergeSort and Reverse for Link List


Peter_APIIT
February 20th, 2008, 04:46 AM
Hello all expert programmer, i looking for mergesort version for link list but i don't understand the algorithm.

http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html

I found a website it does this for us but i really no idea what he does.

I need algorithm description.

Besides that, i also would like to reverse a double link list.

I try to swap head and tail node but it doesn't works.
What i have done so far ?

struct LList* ReverseSwapNode(struct LList* myList,
struct node *front,
struct node *behind)
{
struct node *dummy;

if (myList != NULL)
{
dummy = (struct node *)malloc(sizeof(struct node));
assert(dummy != NULL);
dummy = front;
front->value = behind;
behind = dummy;
}
else
{
exit(0);
}

if (front->previous == NULL && behind->next == NULL)
{
behind->previous = NULL;
front->next = NULL;
}
else
{
}

free(dummy);

return myList;
}
// ------------------------------------------------------

A billion thanks for your help.

Your help is greatly appreciated by me and others.

Peter_APIIT
February 20th, 2008, 08:32 PM
Thread close because duplicate.

Sorry.