mirror of
https://github.com/krahets/hello-algo.git
synced 2026-02-04 11:23:55 +08:00
Add implementation of array binary tree.
Rewrite the tree serialization and deserialization methods. Add applications of array and linked list.
This commit is contained in:
@@ -29,7 +29,7 @@ vector<int> levelOrder(TreeNode *root) {
|
||||
int main() {
|
||||
/* 初始化二叉树 */
|
||||
// 这里借助了一个从数组直接生成二叉树的函数
|
||||
TreeNode *root = vecToTree(vector<int>{1, 2, 3, 4, 5, 6, 7});
|
||||
TreeNode *root = vectorToTree(vector<int>{1, 2, 3, 4, 5, 6, 7});
|
||||
cout << endl << "初始化二叉树\n" << endl;
|
||||
printTree(root);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user