A generalized depth and breadth-first tree search algorithm
Here's a neat little algorithm that can perform a depth-first search (DFS) or breadth-first search (BFS) by simply changing the collection data type:
search( Node root ) {
Collection c = new Collection()
c.push( root )