title: Recursive toString() method in a binary search tree. What is the time complexity for this?
body: <p>I'm a beginner in Java and looking for some help.</p>
  
  <p>So I've made this binary tree in Java, and I'm supposed to implement a method which sorts all elements in order and convert them into a string. It's supposed to look like ex. "[1, 2, 3, 4]". I used the StringBuilder in order to do this.</p>
  
  <p>My code for the method looks loke this:</p>
  
  <pre><code>/**
   * Converts all nodes in current tree to a string. The string consists of
   * all elements, in order.
   * Complexity: ?
   * 
   * @return string
   */
  public String toString() {
      StringBuilder string = new StringBuilder("[");
      helpToString(root, string);
      string.append("]");
      return string.toString();
  }
  
  /**
   * Recursive help method for toString. 
   * 
   * @param node
   * @param string
   */
  private void helpToString(Node&lt;T&gt; node, StringBuilder string) {
      if (node == null)
          return; // Tree is empty, so leave.
  
      if (node.left != null) {
          helpToString(node.left, string);
          string.append(", ");
      }
  
      string.append(node.data);
  
      if (node.right != null) {
          string.append(", ");
          helpToString(node.right, string);
      }
  }
  </code></pre>
  
  <p>So my question is, how do I calculate the time complexity for this? Also, if there are any suggestions in how to make this method better, I would gladly appreciate it.</p>