Time Complexity

for (vector::iterator it = vect.begin() ; it != vect.e
nd(); ++it)
cout << ’ ’ << *it;

what will be the time complexity of the above code?

Hi @dare_devil_007
If we assume that cout << ’ ’ << *it; take O(1) time then this code snippet will have complexity of O(v.size()).

1 Like