3 ms·
Whenever I write a loop, I keep the big-O in the back of my mind. Whenever I linearly scan a data structure for a value, I ask myself I couldn't use a hash look
by perlgeek 15y ago
Whenever I write a loop, I keep the big-O in the back of my mind. Whenever I linearly scan a data structure for a value, I ask myself I couldn't use a hash lookup instead. When loops are nested, my alarm bells start to ring, and I estimate the size of each list I loop over, and try to think of ways to reduce the number of iterations.
So I always track my O()s, even if it doesn't boil down to a rigorous analysis.
- methodin 15y agoI imagine the intuitive, unconscious use of big-o is actually more beneficial as you can immediately identify problem areas without having to bust out paper for complex analysis.