Time Complexity

How is the time complexity o(1)

@ayu_15 hey question no btana?

This doubt is for Q6 in the quiz.

@ayu_15 hi,vector swap ,swaps the addresses(i.e. the containers exchange references to their data) of two vectors rather than swapping each element one by one which is done in constant time O(1).
lets say
v1 = {1,2,3,4};
v2 = {1,2};
after swapping =>
v2 = {1,2,3,4}
v1 = {1,2}
so v1 and v2 now points to different vector, without accessing the elements of the vector.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.