文章
5
粉丝
0
获赞
28
访问
1.7k
#include<bits/stdc++.h>
using namespace std;
struct Node
{
char val;
Node *left,*right;
Node(char c):val(c),left(NULL),right(NULL){};
};
Node* build(string& s,int& x)
{
if(x>=s.size() || s[x] == '#')
return NULL;
char curV = s[x];
Node* node = new Node(curV);
node->left = build(s,++x);
node->right = build(s,++x);
return node;
}
int getDepth(Node* node){
if(node==NULL)
return 0;
return max(getDepth(node->left),getDepth(node->right)) + 1;
}
int main() {
string s;
while(cin>>s)
{
&n...
登录后发布评论
暂无评论,来抢沙发