【发布时间】:2011-09-21 06:47:47
【问题描述】:
标准说std::binary_search(...)和两个相关的函数std::lower_bound(...)和std::upper_bound(...)是O(log n)如果数据结构有随机访问。因此,鉴于此,我假设这些算法在 std::deque 上具有 O(log n) 性能(假设其内容由用户保持排序)。
但是,std::deque 的内部表示似乎很棘手(它被分成了块),所以我想知道:对于 std::deque,O(log n) 搜索的要求是否成立。
【问题讨论】:
标签: c++ complexity-theory binary-search performance deque