Thread: Vectors vs. Linked Lists

  1. #1
    Something Clever ginoitalo's Avatar
    Join Date
    Dec 2001
    Posts
    187

    Vectors vs. Linked Lists

    When would you use Vectors over Linked Lists and vise-versa ?

  2. #2
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    A vector is a linked list that is premade. Personally, I like to use vectors because the code is effecient and already made. Why reinvent the wheel??

  3. #3
    Unregistered
    Guest
    Are Vectors ANSI C++ ?

  4. #4
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    I believe that elements of a std::vector are guaranteed by the C++ standard to be continous in memory, hence it's not a linked list (std::list is the STL linked list).

    You would use a std::vector when you want fast random access; a std::list when you want fast insertion/deletion.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linked Lists 101
    By The Brain in forum C++ Programming
    Replies: 5
    Last Post: 07-24-2004, 04:32 PM
  2. vectors and their relation to linked lists
    By Lurker in forum C++ Programming
    Replies: 2
    Last Post: 12-08-2003, 09:17 PM
  3. need help w/ linked lists
    By MKashlev in forum C++ Programming
    Replies: 11
    Last Post: 08-05-2002, 08:57 PM
  4. doubly linked lists
    By qwertiop in forum C++ Programming
    Replies: 3
    Last Post: 10-03-2001, 06:25 PM