Complexities Flashcards

1
Q

What is the complexity of concatenating n strings of size x to an empty string?

A

each time on concatenation, a new string is created and the two strings are copies over, character by character. so the complexity will be: x+2x+3x+4x+..+nx so it will be o(n^2*x)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly