qaz@lemmy.world to Programmer Humor@programming.devEnglish · 28 天前Who cares about time complexitylemmy.worldimagemessage-square69fedilinkarrow-up1457arrow-down12
arrow-up1455arrow-down1imageWho cares about time complexitylemmy.worldqaz@lemmy.world to Programmer Humor@programming.devEnglish · 28 天前message-square69fedilink
minus-squaredfyx@lemmy.helios42.delinkfedilinkarrow-up44·28 天前There could be a hidden quadratic cost because the string needs to be reallocated and copied multiple times.
minus-squareKogasa@programming.devlinkfedilinkarrow-up5·28 天前Not quadratic in the length of the input. Assuming replace is linear this is also linear
There could be a hidden quadratic cost because the string needs to be reallocated and copied multiple times.
Not if I don’t see it.
This is the spirit
Not quadratic in the length of the input. Assuming replace is linear this is also linear