Please help, I think it should be O(n).
How will the relation in Q3 give O(n^2) complexity?
@Doctor_Insult
assumming vector is defined as vector< int > v
its time complexity will be O(n^2).
because total n calls wiil be there and on every call vector get copied to new vector which is O(n) for each call . therefore O(n^2) for n calls