Блог пользователя ujjaldas223

Автор ujjaldas223, история, 9 лет назад, По-английски

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?

  • Проголосовать: нравится
  • +5
  • Проголосовать: не нравится