본문 바로가기

알고리즘/해커랭크

[해커랭크] Tree: Inorder Traversal [JAVA]

문제링크 : www.hackerrank.com/challenges/tree-inorder-traversal/problem

 

Tree: Inorder Traversal | HackerRank

Print the inorder traversal of a binary tree.

www.hackerrank.com

public static void inOrder(Node root) {
        if(root==null) return;
        inOrder(root.left);
        System.out.print(root.data +" ");
        inOrder(root.right);
    }