Hacker News new | ask | show | jobs
by derefr 4022 days ago
The important part of the "realistic" process is the part where you go from "the crawler's indexing is too slow" to "it might be because it allocates a lot of little bits of memory; it needs to first generate a BST of outbound link weights, and then functionally invert that into a second graph with a bunch of inbound link weights, and then inject all that into the PageRank matrix. You could probably save some time (though at the cost of memory-safety) by inverting the first BST in-place."

Once you get to that point, though, if they asked me "and how would you invert the tree in-place?" I'd answer "well, first I'd make sure we aren't just using a tree structure that already knows how to invert itself, or could easily be extended to know how. Then, assuming that didn't pan out, I'd google 'in-place invert binary tree' and read three or four solutions that already exist to burn the semantic structure of what I'm about to write into my head so that I don't subtly screw it up and have to fiddle with it for the next hour when I could be coding something else. Then I code it."

And that should be enough.