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:
krahets
2023-07-19 16:09:27 +08:00
parent c68f18e480
commit 4e13755023
26 changed files with 680 additions and 178 deletions

View File

@@ -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);