|
|
|
|
|
by johnthuss
1318 days ago
|
|
> I understands the usage of Hash / Map instead of searching arrays and many other small things that actually enhance the code performance I would consider this an assumed skill for any developer with a college degree. It’s basically the point of the entire Data Structures class, which is a degree requirement. |
|
For example:
1. When n is small, an array is almost always better. Arrays have very little overhead compared to even a hash map.
2. Algorithms with the same O() may still have significant differences at runtime and might be balanced differently between insert and search times. AVL trees take longer than Red Black trees to insert, but might be 1 level better in height. That means one less access. Useful for a routing table, for example.
So, in summary, if your looking at other people’s code and see lots of arrays don’t get too smug…n is usually small.