Thread: Simple linked list question

  1. #1
    Addicted to the Internet netboy's Avatar
    Join Date
    Dec 2001
    Posts
    158

    Exclamation Simple linked list question

    Could anybody tell me that is it possible for every node in a linked list A to have an individual linked list?

    Example:
    Linked list A - Node A1, Node A2 and Node A3

    Can I have an individual linked list for A1, A2 and A3?

    Thanks in advance.
    It's unfulfilled dreams that keep you alive.

    //netboy

  2. #2
    Registered User JoshG's Avatar
    Join Date
    Mar 2002
    Posts
    326
    Yes it is possible, never done it though.

    struct list2 {
    int data;
    struct list2 *next;
    }

    struct list1 {
    struct list2 *head;
    struct list1 * next;
    }

  3. #3
    Registered User purple's Avatar
    Join Date
    Mar 2002
    Posts
    28
    This is a good question and it has many uses as well.

    One of the more common uses relates to hashing and how to handle collisions when more then one item hashes to the same location. A very easy and useful technique for handling collisions is the use of "buckets." Which is nothing more then hanging a linked list off of nodes that have multiple items hashed there.

    Just think of your linked list as an array, so anything you can do with an array you can also do with a linked list. Therefore the concept of hanging an individual linked list off every node would equate to nothing more then a two-dimensional array with all the added benefits of an ADT (abstract data type).

  4. #4
    Registered User
    Join Date
    Sep 2001
    Location
    Fiji
    Posts
    212
    Very possible, very complicated. its called a multilist. Why not make them all circularily linked as well

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 11-04-2006, 06:39 PM
  2. Problem with linked list ADT and incomplete structure
    By prawntoast in forum C Programming
    Replies: 1
    Last Post: 04-30-2005, 01:29 AM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. linked list inside array of structs- Syntax question
    By rasmith1955 in forum C Programming
    Replies: 14
    Last Post: 02-28-2005, 05:16 PM
  5. Linked list with two class types within template.
    By SilasP in forum C++ Programming
    Replies: 3
    Last Post: 02-09-2002, 06:13 AM