Q6. of vectors Quiz

Given two vectors v1 and v2, we can swap the contents of the two vectors manually using a O(N + M) time algorithm where N = v1.size() and M = v2.size().

However the vector class provides an inbuilt function swap().

What is the time complexity of v1.swap(v2) ?

It is giving its answer as O(1)…can anyone please explain how?

hello @manthan.joshi.jiit
image