I have an algorithm that takes as input 3 strings, with a strcat concat for each letter like this:

I have to find the time complexity of this algorithm:
char *Generate_ID(char *name,char * surname,char * telephone)
{
int i=0,j=0,k=0;
char s[19];
for(i=0;i<18;i++) s[i]=' ';
for(i=0;i<12;i+=2,j++)
{
if(surname[j]=='\0') break;
s[i]=(surname[j]>='A'&& surname[j]<='Z')? (surname[j]) : (surname[j]-32); /*making uppercase*/
}
for(i=1,j=0;i<12;i+=2,j++)
{
if(name[j]=='\0') break;
s[i] = (name[j] >= 'A'&& name[j] <= 'Z') ? (name[j]) : (name[j] - 32); /*making uppercase*/
}
for(i=0;i<16;i++)
{
if (s[i] == ' ')
s[i] = telephone[(k++)+5];
}
s[16] = (rand() % 26) + 'A'; /*generating random letter uppercase*/
s[17] = (rand() % 26) + 'A'; /*generating random letter uppercase*/
s[18]='\0';
return s;
}
Then:
- The first
for(that adds 32 ASCII to the string) has a complexity of O(n) - The second one, that concatenates the
surnamestring has a complexity about of O(n/2) - The third, that concatenates the
namestring has a complexity of about O(n/2) - The fourth, that concatenates the empty space with a single char of telephone number by 5 character sequentially, has a complexity of O(n/4)
Now to calculate the sum of time complexity, do I have to do (n/4+n/2+n/2+n)?
Since we work with string that can differ max ten characters make sense to talk about Best Time and Worst Time? Is my reasoning right?