Hello,
I am newbie to programming concept, now i am currently working with the LinkList, i am familiar with how the link list work but i wanted to know how reverse link list work and which is the best possible way to do it?
thanks
Hello,
I am newbie to programming concept, now i am currently working with the LinkList, i am familiar with how the link list work but i wanted to know how reverse link list work and which is the best possible way to do it?
thanks
The most efficient way to reverse a linked list is thorough recursion.
Exa on
void rev(struct node *list)
{
if (list->next==NULL)return;
rev(list->next);
printf(ā%dā,list->info);
}
you could also have a good tutorial on the follwing link:
http://www.inversereality.org/tutori...nkedlists.html
Searching a linked list is a very easy concept, just traverse each node till the next node pointer value is NULL and see if the value in the node matched the one we have to search or not.
Sorting a linked list can be a bit complicated though, we can use bubble sort, radic sort and heap sort technique and swap values using functions.
Even though all this sort are conceptually easy to understand but at the same time they are bit confusing while implementing.
cheers
Bookmarks