Why the time complexity isO(N*2) not O(N)?
Why the time complexity isO(N*2) not O(N)?
@Rhinorox,
the time complexity for this problem should be O(n^2) , since the function is called by value thus at each call the vector will be copied to v and since copying vector of size n takes o(n) time and n function calls will result in time complexity being o(n^2)
if vector have been passed by address or reference then the time complexity would have been O(n)
In case of any doubt feel free to ask
mark your doubt as resolved if you got the answer
Quiz_2______________Q_3
paste the question statement you are referring to
Mind Blown Thank you