Complexity requirements for std::deque::push_back/front

前端 未结 2 1096
迷失自我
迷失自我 2021-01-02 03:33

As a result of this question from a few days ago there are a few things that have been bugging me about the complexity requirements for std::deque::push_back/push_fron

2条回答
  •  滥情空心
    2021-01-02 04:13

    I suspect that the reallocation of the block pointers is done with a geometrically increasing size - this is a common trick for std::vector. I think this is technically O(log m) but as you point out m << n, so as a practical matter it doesn't affect the real-world results.

提交回复
热议问题