Results 1 to 3 of 3

Thread: How to sort & search a single linklist?

  1. #1
    Join Date
    Oct 2008
    Posts
    89

    How to sort & search a single linklist?

    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

  2. #2
    Join Date
    Apr 2008
    Posts
    193
    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

  3. #3
    Join Date
    Mar 2008
    Posts
    349
    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

Similar Threads

  1. Sort and search your emails with OutlookDeck
    By SoftwareGuy in forum Tips & Tweaks
    Replies: 1
    Last Post: 03-06-2011, 04:24 AM
  2. Replies: 4
    Last Post: 05-04-2011, 04:29 AM
  3. Replies: 3
    Last Post: 04-01-2011, 01:25 AM
  4. How to use Bubble sort in C# to sort parallel arraylists
    By Ground 0 in forum Software Development
    Replies: 3
    Last Post: 03-08-2009, 12:12 PM
  5. Replies: 1
    Last Post: 19-03-2009, 05:55 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,717,369.35564 seconds with 17 queries