Skip to content

Commit

Permalink
Update 1099. Build A Binary Search Tree (30).cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
liuchuo committed Nov 16, 2020
1 parent 2d3d4d9 commit 408dc0d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions AdvancedLevel_C++/1099. Build A Binary Search Tree (30).cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
using namespace std;
int n, cnt, b[100], maxLevel;
struct node {
int data, l, r, level;
int data, l, r;
}a[110];
vector<int> v[100];
void dfs(int root, int level) {
maxLevel = max(level, maxLevel);
if (a[root].l != -1) dfs(a[root].l, level + 1);
a[root] = {b[cnt++], a[root].l, a[root].r, level};
a[root] = {b[cnt++], a[root].l, a[root].r};
if (a[root].r != -1) dfs(a[root].r, level + 1);
}
int main() {
Expand Down

0 comments on commit 408dc0d

Please sign in to comment.