algorithm

this has the traversal algorithm.