Added iterative solution to max depth of tree