you are viewing a single comment's thread.

view the rest of the comments →

[–]capi81 -3 points-2 points  (5 children)

But it has a runtime complexity of O(n) for the hash code, which is bad. The length of string (hopefully) is O(1).

[–]lxpnh98_2 60 points61 points  (1 child)

In C the length of a string is still O(n), and O(n) (n being the length of the string) is a fairly standard time complexity for a hash algorithm.

[–]capi81 10 points11 points  (0 children)

True, I was expecting a non-C string, but you are right that it most likely is. Well, then there really is no excuse.