Let T be a binary tree with n nodes (T may be realized with an array list or a linked structure).
Give a linear algorithm that uses the methods of the binary tree interface to traverse the nodes of T in pre-order manner. Since operations associated with visiting each node is constant, the running time of the algorithm is O(n).