How to print tree in an inorder traversal (java)?
<p>I am trying to print my AVLtree as following,</p>

<pre><code>. 50

55

. . 60

. 65

. . 70
</code></pre>

<p>– The entry for a node should be preceded by depth number of dots, where depth denotes the depth of the node in the tree.</p>

<p>root contains 55 and the left child contains 50, the right child contains 65, the right left child contains 60 and the right-right child contains 70 .</p>

<p>Below is my code so far. Can anyone help? </p>

<pre><code>public string Display() {
    StringBulder sb= new StringBulder();
    inOrder (node,1,sb);
    return sb.toString();
}

// inorder traversal
public void inOrder (AVLNode&lt;E&gt; node, int depth, StringBuilde sb) {
    for (int i=1;i &lt; depth; i++){
        sb.append(".");
    }

    if(node == null) return;

    inOrder(node.getleft(), depth+1,sb);
    sb.append(node.data);
    inOrder(node.getright(),depth+1,sb); 
}
</code></pre>
