Linked Lists...

This is a discussion on Linked Lists... within the C++ Programming forums, part of the General Programming Boards category; Im wondering, to access data stored in the linked list's "node" number X, you actually have to move on node ...

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    7

    Linked Lists...

    Im wondering, to access data stored in the linked list's "node" number X, you actually have to move on node by node with a loop X times, then use the pointer to retrive the data???

    Correct me if im wrong...
    BTW what are the practical uses of linked lists?

  2. #2
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,304

    Cool

    Quote Originally Posted by SoulBlade
    Im wondering, to access data stored in the linked list's "node" number X, you actually have to move on node by node with a loop X times, then use the pointer to retrive the data???

    Correct me if im wrong...
    BTW what are the practical uses of linked lists?
    People don't do that with lists, they use arrays if they want random access.

    Ask yourself, how easy is it to insert something near the start of an array? A list?

    Have a good thorough read of: http://faq.cprogramming.com/cgi-bin/...&id=1073086407

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    7
    Quote Originally Posted by iMalc
    People don't do that with lists, they use arrays if they want random access.
    Thats what I needed, thanx

  4. #4
    Registered User
    Join Date
    Nov 2005
    Posts
    52
    Personally, when I want random access I use a std::vector, not an array :-P

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Singly Linked Lists: Clarification Needed
    By jedispy in forum C++ Programming
    Replies: 4
    Last Post: 12-14-2006, 04:30 PM
  2. Linked Lists 101
    By The Brain in forum C++ Programming
    Replies: 5
    Last Post: 07-24-2004, 04:32 PM
  3. Map file formats and linked lists
    By Spitball in forum Game Programming
    Replies: 2
    Last Post: 03-04-2004, 10:32 PM
  4. need help w/ linked lists
    By MKashlev in forum C++ Programming
    Replies: 11
    Last Post: 08-05-2002, 08:57 PM
  5. doubly linked lists
    By qwertiop in forum C++ Programming
    Replies: 3
    Last Post: 10-03-2001, 06:25 PM

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