Problem 68a

Solution 1

preorder : Tree a -> List a
preorder tree =
    case tree of
        Empty ->
            []

        Node v l r ->
            v :: (preorder l) ++ (preorder r)

Back to problem

results matching ""

    No results matching ""