Thread: linked list creation

  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    44

    linked list creation

    hi,
    i want to create a link list , which i can by adding the elements at the end,
    if size is known.
    however, suppose i do not know the size of the list. say, the user can keep on adding the nodes limited by the size of the virtual memory.
    How should I create the linked list class ?

    any ideas? I am not asking to write the code for me, just function prototypes and the methodology.

    thanks
    sedy

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    As long as you are keeping tracking of the insertion point, the size of the list does not matter (other than the fact that your machine has limited memory).
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    May 2011
    Posts
    44
    ok, so you mean, I can add ,say a while loop in the user file which does not test for the size but whether the user wants to add new nodes, i should be ok?

    sedy

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    If I understand you correctly, yes. Why were you testing for size?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    May 2011
    Posts
    44
    well, somebody asked me this, so i was not sure is that the way to do or not.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linked List, node creation question
    By Alec0905 in forum C++ Programming
    Replies: 5
    Last Post: 10-03-2010, 09:45 AM
  2. single linked list to double linked list (help)
    By Countfog in forum C Programming
    Replies: 8
    Last Post: 04-29-2008, 08:04 PM
  3. Linked List creation
    By thedoofus in forum C Programming
    Replies: 2
    Last Post: 05-01-2005, 11:51 AM
  4. singly linked list to doubly linked list
    By t48j in forum C Programming
    Replies: 3
    Last Post: 03-23-2005, 06:37 PM
  5. Replies: 6
    Last Post: 03-02-2005, 02:45 AM