I am wondering what is the expected time complexity of passing variables into the function.
Suppose you have a large string and you are passing that into the function then what would be the time complexity.
And if we assign a variable to a string so in that case how much time the assignment operation takes.
#include <bits/stdc++.h>
using namespace std;
void func(string s)
{
return;
}
int main()
{
string s;
cin>>s;
for(int i = 0; i < s.size(); i++)
{
func(s);
}
return 0;
}What is the time complexity for this code?
And suppose we have a string s and it consist of 1e8 characters.
Now we are assigning its value to a variable t,
t = s (so what would be the time complexity for this)
Sometimes, there is a lot of confusion regarding Time Complexity.
Pls, help me out !!
Thanks