题解

这道题目说的很诡异,其实没有什么把括号补上。。。。仅仅是先序读入,然后中序输出就行了

代码

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct TreeNode
{
char data;
struct TreeNode *LChild, *RChild; }TreeNode;
char *c;
void Create(TreeNode **T)
{
if(*c=='#')
{
(*T) = NULL;
c++;
return ;
}
(*T) = (TreeNode*)malloc(sizeof(TreeNode));
(*T)->data = *c;
c++;
Create(&(*T)->LChild);
Create(&(*T)->RChild);
}
void Print(TreeNode*T)
{
if(!T)
return;
Print(T->LChild);
printf("%c",T->data);
Print(T->RChild);
}
int main()
{
static char buf[10000];
scanf("%s",buf);
c = buf;
TreeNode *T;
Create(&T);
Print(T);
return 0;
}
/*
*+a(###b#)##c##
*/

最新文章

  1. 使用 Vue 2.0 实现服务端渲染的 HackerNews
  2. 结构体内嵌函数指针实现C语言面向对象
  3. flash全屏输入模式
  4. GridControl 继承写法修改自己的GridControl
  5. C# Socket通信 小案例
  6. Spring mvc中@RequestMapping 6个基本用法整理
  7. 3522: [Poi2014]Hotel( 树形dp )
  8. C# Web.config 配置handlers 和 httpHandlers
  9. Storm学习笔记 - 消息容错机制
  10. js基础语句
  11. linux:644、755、777权限详解
  12. 51nod--1298 (计算几何基础)
  13. Python 文件操作三
  14. Spring MVC 和 Struts2 的比较
  15. ActiveMQ 集群负载平衡
  16. opencv2.4.10与VS2013的环境配置
  17. Part15 – 前端之jQuery
  18. Unity3d实现幸运转盘
  19. 【POJ】1185 炮兵阵地(状压dp)
  20. win8平板APP开发的教程文章

热门文章

  1. Chrome 中的自动播放政策
  2. 【数据库】MYSQL如何添加索引
  3. 将MySQL查询结果导出到Excel
  4. 好客租房20-react组件介绍
  5. 好客租房9-jsx的学习目标
  6. nodejs使用 svg-captcha 做验证码及验证
  7. 利用SignalR创建即时消息
  8. 浏览器上写代码,4核8G微软服务器免费用,Codespaces真香
  9. 是时候为Spring Boot 3.0做准备了
  10. wsl2环境搭建