[Solved] Maximum tree depth in Haskell
You would want to write a recursive function to do this. For each Tree constructor, you’ll need a different case in your function. To start with, you know that the depth of any Leaf is 1, so maxDepth :: Tree -> Int maxDepth (Leaf _) = 1 maxDepth (Branch2 c left right) = maximum [???] … Read more