3 ms·
Yeah - totally agree, this was just intended an a serendipitous anecdote. In this case it was, though, a clearly constrained problem space. For only a few hundr
by bigiain 6y ago
Yeah - totally agree, this was just intended an a serendipitous anecdote. In this case it was, though, a clearly constrained problem space. For only a few hundred rarely changed nodes, an O(n^4) algorithm (running O(n^2) against every possible n^2 pair of nodes) is perfectly amenable to brute force and caching the results.
Totally wouldn't work for Google Maps doing shortest path routing globally, but for an event with only a couple of hundred POIs and intersections, it's a cheat that seems almost magical to people who have some concept of the algorithmic problem, but haven't worked out the "trick".
If I were asked to whiteboard this, I would 100% be asking that constraints of the dataset up front. (I'm not too sure I'd have been smart enough to do that a couple of decades back, when I last had a "perform for us code-monkey!" type of job interview...)