ujjaldas223's blog

By ujjaldas223, history, 9 years ago, In English

I am using sets in c++. The below code is :

#include<bits/stdc++.h>
using namespace std;
int main(){
    set<int> s1({1, 2, 3}), s2({2, 3, 1});
    if(s1 == s2)
        cout << "Two sets are equal\n";
    else
        cout << "Two sets are different\n";
    return 0;
}

My question is — Given 2 sets both having n elements, when these 2 sets are compared using == operator, what is the time complexity for it?

  • Vote: I like it
  • +5
  • Vote: I do not like it