import Foundation
class BinaryTreeNode {
let value: Int
var left: BinaryTreeNode?
var right: BinaryTreeNode?
init(_ value: Int) {
self.value = value
}
}
struct BinaryTree {
var root: BinaryTreeNode?
func preOrderDisplay(_ node: BinaryTreeNode?) {
guard let node = node else { return }
print("\(node.value) ")
preOrderDisplay(node.left)
preOrderDisplay(node.right)
}
}