TSINGK110 二叉树遍历⭐️难度较难⭐️类型树题目题目链接示例1输入abc##de#g##f###输出c b e g d f a题解#define_CRT_SECURE_NO_WARNINGS#includestdio.husingnamespacestd;structTreeNode{chardata;TreeNode*left;TreeNode*right;};TreeNode*RecursiveBuildTree(inti,charstr[]){charcstr[i];i;if(c#){returnNULL;}else{TreeNode*pNewnewTreeNode;pNew-datac;pNew-leftRecursiveBuildTree(i,str);pNew-rightRecursiveBuildTree(i,str);returnpNew;}}voidInOrder(TreeNode*proot){if(prootNULL){return;}InOrder(proot-left);printf(%c ,proot-data);InOrder(proot-right);}intmain(){charstr[1000];while(scanf(%s,str)!EOF){inti0;TreeNode*prootRecursiveBuildTree(i,str);InOrder(proot);printf(\n);}return0;}