3 ms·
If your strings are short that's basically O(1), which could be nice for some workloads - enums, json keys, etc.
by kevingadd 7y ago
If your strings are short that's basically O(1), which could be nice for some workloads - enums, json keys, etc.
- leetcrew 7y agoif all your strings are of size < c, you can do any string operation on a single string in constant time.
- saagarjha 7y agoThere are certain (randomized) operations that you can’t…
- jacwah 7y agoThat's not what O(1) means. If your strings are short, complexity doesn't matter either way.
- admax88q 7y agoThat's still misleading. If all my input is small then O(n^2) is basically O(1) as well.
- naniwaduni 7y agoEverything is O(1) when you have finite bounded input.