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