DEV Community

Discussion on: Log and Exponential for Programmers

Collapse
 
millebi profile image
Bill Miller

Always remember that the theoretical efficiency of your algorithm may not be the actual runtime efficiency, because your data may not match what you expected when you wrote the algorithm or memory/CPU/compiler limitations may effect the actual efficiency.

So many people have discovered (the hard way) that an algorithm that looks efficient, turns out to be dog slow when actually implemented due to unexpected problems injected into the actual running solution.

e.g. A Hashtable is only better than a sequential search when the data is reasonably unique (based on your hashing algorithm), if the data almost always results in the same hash there's a good chance that a sequential search may be used to find the item within the bucket.

Beware of over-engineering without reasonable testing!