容器set

//set底层是红黑树,有序。unordered_set底层是哈希,无须,但查找效率高,速度快 
#include <iostream>
#include <set>
using namespace std;
int main()
{
    set<int>s;
    s.insert(2);
    s.insert(4);
    for(auto x:s)
    cout<<x<<endl; 
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/zmachine/p/12289875.html
今日推荐