C++ STL----linear sequence

Vector:ide

Vectors are good at:
spa

  • Accessing individual elements by their position index (constant time).
  • Iterating over the elements in any order (linear time).
  • Add and remove elements from its end (constant amortized time).

List:.net

This provides the following advantages to list containers:
orm

  • Efficient insertion and removal of elements anywhere in the container (constant time).
  • Efficient moving elements and block of elements within the container or even between different containers (constant time).
  • Iterating over the elements in forward or reverse order (linear time).

Deque:ci

Deque sequences have the following properties:
element

  • Individual elements can be accessed by their position index.
  • Iteration over the elements can be performed in any order.
  • Elements can be efficiently added and removed from any of its ends (either the beginning or the end of the sequence).

Stack:rem

The standard container class templates vector, deque and list can be used. By default, if no container class is specified for a particular stack class, the standard container class template deque is used.get

相關文章
相關標籤/搜索