可能的重复:
标准容器的复杂性保证是什么?
从我昨天的问题的答案std::queue; >::size() 的 O(n) 时间很慢? 我了解到我对 STL 容器性能特征的假设并不总是正确的。是时候学习了!
您是否知道任何“备忘单”,例如有关常见 STL(也许还有 Boost)容器的概述,例如 vector
、list
、deque
、< code>map、hash_map
/unordered_map
等关于插入、删除、size() 等操作的性能特征(如标准所示)。 ?
Possible Duplicate:
What are the Complexity guarantees of the standard containers?
From the answers to my yesterday's question std::queue<T, list<T> >::size() is slow in O(n)? I learned that my assumptions on STL container performance characteristics are not always right. Time to learn!
Do you know about any "cheat sheet" like overview about common STL (and maybe also Boost) containers like vector
, list
, deque
, map
, hash_map
/unordered_map
etc. regarding the performance characteristics (as indicated by the standard) for operations like insertion, deletion, size() etc.?
发布评论
评论(1)
此处。
There is a nice chart which compares performances of all standard library containers here.