What is the time complexity for comparing two sets in c++?

Правка en1, от ujjaldas223, 2018-03-30 07:11:42

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?

Теги c++ 14, c++ stl, #set

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский ujjaldas223 2018-03-30 07:11:42 500 Initial revision (published)