文章
7
粉丝
56
获赞
0
访问
3.8k
审核题目真烂阿,能不能认真点?
层序遍历我也实现了,没打印而已
import java.util.ArrayDeque;
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String[] inStrs = in.nextLine().split(" ");
Node tree = toTree(inStrs);
StringBuilder sb = new StringBuilder();
preOrder(tree, sb);
if(sb.length() > 0) sb.deleteCharAt(sb.length()-1);
System.out.println(sb.toString());
sb = new StringBuilder();
inOrder(tree, sb);
if(sb.length() ...
登录后发布评论
暂无评论,来抢沙发