1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| class TreeNode(var value: Int) { var left: TreeNode? = null var right: TreeNode? = null }
fun dfs(root: TreeNode?) { root?: return dfs(root.left) dfs(root.right) }
fun visit(root: TreeNode){ println(root.value) }
|