scala--简洁优雅的树定义

也许还不够优雅。   trait Tree[+T] { /** * 深度优先遍历 */ def dfs(func: T => Unit) { this match { case Empty => case Node(value, left, right) => func(value);
相关文章
相关标签/搜索