究竟为什么会有人使用的一系列而不是unordered_set?而不是、系列、unordered_set

由网友(千城暮雪ぅ)分享简介:请,原谅我的无知这个主题:)Please, excuse my ignorance about this subject :)的C ++ 0x推出 unordered_set 这是提升和其他许多地方使用。我的理解是, unordered_set 与哈希表O(1)查询的复杂性。在另一方面,设置不过是树的log(n)查...

请,原谅我的无知这个主题:)

Please, excuse my ignorance about this subject :)

的C ++ 0x推出 unordered_set 这是提升和其他许多地方使用。我的理解是, unordered_set 哈希表O(1)查询的复杂性。在另一方面,设置不过是树的log(n)查询的复杂性。 究竟为什么会有人使用设置,而不是 unordered_set 的?即是否有必要对设置了吗?

C++0x is introducing unordered_set which is available in boost and many other places. What I understand is that unordered_set is hash table with O(1) lookup complexity. On the other hand, set is nothing but a tree with log(n) lookup complexity. Why on earth would anyone use set instead of unordered_set? i.e is there a need for set anymore?

推荐答案

在,人谁愿意来遍历集合的项目,顺序问题。

When, for someone who wants to iterate over the items of the set, the order matters.

阅读全文

相关推荐

最新文章