5 ms·
IMO don't generalize unless you find out later you need the same algorithm somewhere else. Otherwise, just leave the specific version in and stick some info in
by nottorp 9y ago
IMO don't generalize unless you find out later you need the same algorithm somewhere else.
Otherwise, just leave the specific version in and stick some info in the comments (like a link to the high level description of the algorithm, if it's a common one that has a name, plus some pointers to your specifics).
- taeric 9y agoCompletely agreed. I do recommend playing with it (in like a repl or some other place) to see if you can possibly improve the algorithm, but have specific metrics for what an improvement would be. I'm reminded of a section in Programming Pearls where they explore several versions of a function, each time improving it. Too often I'm impatient and want the final solution first.