mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 12:58:42 +08:00
Feature/array representation of tree swift (#649)
* refactor: encode & decode Tree * style: build warning * feat: add Swift codes for array_representation_of_tree article
This commit is contained in:
@ -31,7 +31,7 @@ enum BinaryTreeBFS {
|
||||
static func main() {
|
||||
/* 初始化二叉树 */
|
||||
// 这里借助了一个从数组直接生成二叉树的函数
|
||||
let node = TreeNode.listToTree(list: [1, 2, 3, 4, 5, 6, 7])!
|
||||
let node = TreeNode.listToTree(arr: [1, 2, 3, 4, 5, 6, 7])!
|
||||
print("\n初始化二叉树\n")
|
||||
PrintUtil.printTree(root: node)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user