According to C++ standard std::deque is something like
std::vector<std::array<T, M> *>
If so, how is it possible that insertion or removal of elements at the end or beginning is constant O(1)? If the capacity of the vector exceeded and we insert something at the end or beginning there is no guarantee the the entire vector is not reallocated, so we have 0(N/M) that actually is 0(N), isn't it? (N is the size of the deque).
Aucun commentaire:
Enregistrer un commentaire