Problem 62b Solutions

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

        Node v left right ->
            if left == Empty && right == Empty then
                []
            else
                getInternals left ++ v :: getInternals right

Back to problem

results matching ""

    No results matching ""