3 ms·
"strcat(strcat(strcat(strcpy(buf, "This "),"is "),"a long "),"string."); len = strlen(buf); > The above example executes in exponential time with the length
by pkolaczk 11y ago
"strcat(strcat(strcat(strcpy(buf, "This "),"is "),"a long "),"string.");
len = strlen(buf);
> The above example executes in exponential time with the length of the strings.
This statement is obviously not true. The example is linear with the length of the strings (assuming the number of strings is constant) and O(n^2) with the number of strings (assuming each string has non-zero length).