Hacker News new | ask | show | jobs
by sqd 2665 days ago
I can surely do a pre-order DFS and record the order of the nodes I visited, and then another DFS to modify the pointers? That would still be O(n).