Solution (source code)

= Solution

Use the remaining ascending <list> itself as the seed:
``
buildUnfold :: [a] -> Tree a
buildUnfold = unfoldTree split
  where
    split [] = Nothing
    split xs =
      let (ls,x:rs) = splitAt (length xs `div` 2) xs
      in Just (ls,x,rs)
``
The empty seed produces `Empty`. Every nonempty seed produces exactly the midpoint and two child seeds used by `build`. Thus the defining equations agree, and <structural induction> on the finite input proves `buildUnfold xs = build xs`. The balance and ordering arguments carry over unchanged.