Doubly Linked-List, Linked-lists and dynamic arrays in C++ -


i'm new c++ , these questions simple , basic [and sorry that!]. here have 2 basic questions:

  1. as understand vectors in c++ dynamic arrays. can change size pushing back/front elements them.

    my question is: vectors allocated dynamically or "dynamic array" name called because of changing size capability? dynamically allocated array , dynamic arrays make me confused!

  2. stl lists linked-lists in c++ (again, understand). these doubly-linked lists or singly-linked list?

thanks,

vectors allocated dynamically, can see in mentioned documentation. can see better in push_back function:

if new size() greater capacity() iterators , references (including past-the-end iterator) invalidated. otherwise past-the-end iterator invalidated.

also, stick in mind complexity amortized constant (as instance, can see this).

for more info (mentioned in comments), can find real list forward_list:

it implemented singly-linked list , not have overhead compared implementation in c. compared std::list container provides more space efficient storage when bidirectional iteration not needed.

also, mentioned in documentation, list implemented doubly linked list.

list containers implemented doubly-linked lists; doubly linked lists can store each of elements contain in different , unrelated storage locations. ordering kept internally association each element of link element preceding , link element following it.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -