linked list creation

This is a discussion on linked list creation within the C++ Programming forums, part of the General Programming Boards category; hi, i want to create a link list , which i can by adding the elements at the end, if ...

  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
    21,725
    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).
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    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
    21,725
    If I understand you correctly, yes. Why were you testing for size?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    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, 05:37 PM
  5. Replies: 6
    Last Post: 03-02-2005, 01:45 AM

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