Results 1 to 6 of 6

Thread: What is a linked list?

  1. #1
    Join Date
    Nov 2009
    Posts
    51

    What is a linked list?

    Hello,
    I am T.Y.B.Sc. student. As per our syllabus we have C programming language. I recently started learning C language. In our last tutorial our sir has asked question What is a linked list? I had never heard this type of any term that's why I unable to write it's answer. Please if you have any idea about this term share with me.
    Thanks in advanced.

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: What is a linked list?

    Linked list is a type of datastructure that collect either different type of data or same type of data. These data are basically stored in node. Usually node have non primitive data that are stored in to two parts. One part have data and other part have address of next node.

  3. #3
    Join Date
    Oct 2005
    Posts
    2,393

    Re: What is a linked list?

    Linked list is a type of datastructure made up of nodes that collect various data. Each node have two parts one is Information part and other is linked part.
    1.Information part=This part contain value of data elements.
    2.linked part=This part contains address of the next node or adjacent node.
    In Linked list we stored information linear format.

  4. #4
    Join Date
    May 2008
    Posts
    2,389

    Re: What is a linked list?

    A linked list is collection of data in linear format. It consist of nodes. All nodes are linearly connected. The linear format is supported by pointer. You can find linked list in either doubly or liner or circular format.

  5. #5
    Join Date
    Feb 2008
    Posts
    1,852

    Re: What is a linked list?

    Here I just given you program to understand linked list.
    Code:
    Basic linked list example
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    struct Linkedlist {
     char *str1;
     struct Linkedlist *next1;
    };
    
    int main(void) {
     char line[1024];
     struct Linkedlist *h = NULL;
     struct Linkedlist *n = NULL;
    
     while(fgets(line, 1024, stdin) != NULL) {
      n = (struct Linkedlist *)malloc(sizeof(struct Linkedlist));
      n->next1 = h;
      h = n;
    
      n->str1 = strdup(line);
     }
    
     while(h != NULL) {
      printf("%s\n", h->str1);
      h = h->next1;
     }
    
     return 0;
    }

  6. #6
    Join Date
    Feb 2009
    Posts
    96

    Re: What is a linked list?

    Since most people tend to always give absolute definitions I'll try to explain it in layman's terms.
    a linked list is a list of items that in some way relate to each other to create a kind of data structure that can be read through and manipulated easier. like links of a chain.
    example

    you can have 2 linked lists that work with each other.
    1 can be prices of seats of and airline
    and the other can be a list of passengers for the airline and the seat they reserved.

Similar Threads

  1. Problem with Java linked list
    By XeroX in forum Software Development
    Replies: 1
    Last Post: 13-06-2012, 03:37 PM
  2. Joomla Linked up files no able to list
    By Jahnavi6 in forum Technology & Internet
    Replies: 4
    Last Post: 15-07-2010, 02:39 AM
  3. Dynamic Linked List In Jsp
    By rashmi_ay in forum Software Development
    Replies: 5
    Last Post: 23-02-2010, 10:50 PM
  4. Problem using Linked list in java
    By Aaliya Seth in forum Software Development
    Replies: 5
    Last Post: 18-02-2010, 01:06 AM
  5. Better way to sort a linked list in c++
    By Juany in forum Software Development
    Replies: 5
    Last Post: 13-02-2010, 04:30 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,687,581.77887 seconds with 17 queries