2 ms·
> That's something you have to bolt on to the get the O(1) hashtable result. No, you brought that on by claiming not considering it was an error. In standard
by magicalhippo 2y ago
> That's something you have to bolt on to the get the O(1) hashtable result.
No, you brought that on by claiming not considering it was an error.
In standard big-O you take as an assumption that memory operations are O(1), comparisons are O(1) and calculating hash values are of the same order as making a comparison (and vice versa).
Once you do that, then a hash table becomes O(1) on average, as it's just a O(1) calculation followed by a O(1) memory lookup (assuming no collisions on average).
- SilasX 2y ago>In standard big-O you take as an assumption that memory operations are O(1) No. If it look up big-O in a math book, it's not going to say anything about that. You can add assumptions on, but that's not big-O anymore, but something different. That's the point.