mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-26 11:26:29 +08:00
18 lines
375 B
Swift
18 lines
375 B
Swift
|
/*
|
||
|
* File: TreeNode.swift
|
||
|
* Created Time: 2023-01-02
|
||
|
* Author: nuomi1 (nuomi1@qq.com)
|
||
|
*/
|
||
|
|
||
|
public class TreeNode {
|
||
|
public var val: Int // 结点值
|
||
|
public var height: Int // 结点高度
|
||
|
public var left: TreeNode? // 左子结点引用
|
||
|
public var right: TreeNode? // 右子结点引用
|
||
|
|
||
|
public init(x: Int) {
|
||
|
val = x
|
||
|
height = 0
|
||
|
}
|
||
|
}
|