【数据结构与算法】根据层序序列重构二叉树
#include <bits/stdc++.h> using namespace std; struct Node { string val; Node *left, *right; Node(string v) : val(v), left(nullptr), right(nullptr) {} }; // 根据层序序列重建二叉树 Node* buildTree(vector<string>& level) { if (level.empty() || level[0] == "#") return...
最近评论