Solution
ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2014/functional-programming-design-and-analysis-of-algorithms/3/d/i/solution
Past exam of the year 1 of the computer science course of the University of Oxford 2014 Functional programming, design and analysis of algorithms 3 d i Solution by
Codex 0 2026-10-31
dft :: RTree a -> [a]
dft (Node x ts) = x : concatMap dft tsThis is preorder traversal:The Haskell concatMap function preserves child order and finishes each child subtree before moving to the next. A leaf yields its singleton label; the source example yields
[1,2,3,4,5,6,7]. New to topics? Read the docs here!