Problem 71 Solution

internalPathLength : MTree a -> Int
internalPathLength mtree =
    let 
        ipl depth (MNode v list) =
            if List.length list == 0 then
                depth
            else
                depth + List.sum (List.map (ipl (depth + 1)) list)
    in
        ipl 0 mtree

results matching ""

    No results matching ""