Question 3 , about complexity

Why it is n^2 ??
Isnt it should be O(n)
Is it because of copying of the vector ?? or smthng else?

@learn.cp.course
Yes it is because of copying of vector. Since on every call vector get copied to new vector which is O(n) for each call . therefore O(n^2) for n calls

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.