Created
April 14, 2022 09:05
-
-
Save KrauserHuang/4fce8aaba22f5fd63b08e290115f415b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
public class Node { | |
var value: Int | |
var left: Node? | |
var right: Node? | |
public init(_ value: Int) { | |
self.value = value | |
} | |
} | |
var node_1 = Node(5) | |
var node_2 = Node(2) | |
var node_3 = Node(7) | |
var node_4 = Node(1) | |
var node_5 = Node(3) | |
var node_6 = Node(10) | |
node_1.left = node_2 | |
node_1.right = node_3 | |
node_2.left = node_4 | |
node_2.right = node_5 | |
node_3.right = node_6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment