目录 1.2 unordered_set 1.4 unordered_map 一,unordered系列容器 在C++98中,STL提供了以红黑树为底层的一系列关联式容器,查询时效率可达到logN,但是当树中节点非常多时,查询效率也不理想,所以在C++11中,STL提供了unordered系列的几个容器,使用哈希表作为底层,大大增加了查询效率 关于unordered_set的使用和之前介绍的set大体相同,如下代码: void test_unordered_set() { unordered_set<int> s; s.insert(2); s.insert(3); s.insert(1); s.insert(2); s.insert(5); unordered_set<int>::iterator it = s.begin(); while (it != s.end()) { cout << *it << " "; ++it; } cout << endl; } void test_unordered_map() { string arr[] = { "西瓜", "西瓜",...