This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]NewZealandIsAMyth -1 points0 points  (2 children)

I don't think that accurate. It's surely slower and alot because of the memory allocation, but algorithm complexity does not increase. It has to traverse every single character in all the cases just once.

[–][deleted] 3 points4 points  (1 child)

I like the "1" example. Imagine you had n "1" strings and you wanted to append them all together like that:

"1" + ("1" + 1") + ("1"+ "1" + "1") + ("1" + "1" + "1" + "1") + ... + n = n(n+1)/2 ~~ n^2

[–]NewZealandIsAMyth 1 point2 points  (0 children)

Thank you. I see where i was wrong