pre order traversal of tree. (recursive, non-recursive)