Take a look at
Tree and the traverse() method, specifically the child-first option. You can then keep track of the path down to the node in a stack and just stop traversing when you hit the node you care about.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?