Link lists

This is a discussion on Link lists within the C++ Programming forums, part of the General Programming Boards category; Im mostly a C person, can anyone explain these to me and maybe give an example?...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    46

    Link lists

    Im mostly a C person, can anyone explain these to me and maybe give an example?

  2. #2
    Registered User
    Join Date
    Jun 2002
    Posts
    82
    A linked list can be thought of as a train; you have a series of cars that all link together the same way, while in a linked list you have a series of "nodes", which can be thought of as a box with two pointers: one to a variable of arbitrary type, and the other to another node. The cars can contain anything you want; in an ideal linked list, each "node" can contain anything you want (string, int, Widget, etc.). You can separate two cars and insert another in between them; you can insert a new node in the middle of a linked list without disturbing the rest too much. You can search your train one car at a time until you find what you're looking for, same with the linked list. The train ends with a caboose; the last node has its "next" pointer set to null.

    A good reference for these (and other data structures), as I just placed in another post (deja vu) is

    http://www.brpreiss.com/books/opus4/html/book.html
    Last edited by geophyzzer; 12-11-2002 at 01:09 PM.
    Claus Hetzer
    Compiler: Borland 5.5 (on Windows)
    Solaris CC (on Unix)
    Known Languages: C++, MATLAB, Perl, Java

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,643
    ...or just click the search button at the top of this page. There have been a whole lot of posts on this topic.
    Code:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I'm confused about link lists (again)
    By JFonseka in forum C Programming
    Replies: 4
    Last Post: 06-13-2008, 08:13 PM
  2. functions using link lists
    By chood72 in forum C++ Programming
    Replies: 3
    Last Post: 10-31-2005, 02:51 PM
  3. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM
  4. Link lists as datastructure
    By stseitli in forum C Programming
    Replies: 13
    Last Post: 07-09-2002, 07:34 AM
  5. double link lists
    By rumi_red in forum C++ Programming
    Replies: 3
    Last Post: 10-30-2001, 09:13 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21