Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Space proportional to node count (used for a pointer or a tree size or something fancier) is up to exponentially larger than space proportional to tree depth (for a stack representing the state of a traversal), the same if every node has only one child.

It might be a competitive approach if the tree is very unbalanced or there are enough concurrent traversals, but in main experience the main reason to use parent pointers or the like are operations that are not visiting each node once starting from the root.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: