title: Recursive method for level order traversal
body: <p>The <code>levelOrder</code> method needs to call itself recursively to perform level order traversal. I'm having trouble in how to add (this) to accumulator. This is what I have so far.</p>
  
  <pre><code>public class BinaryTreeNode&lt;T&gt; {
      private BinaryTreeNode&lt;T&gt; left;
      private BinaryTreeNode&lt;T&gt; right;
      private T data;
  
      public BinaryTreeNode() {
          this(null, null, null);
      }
  
      public BinaryTreeNode(T theData) {
          this(theData, null, null);
      }
  
      public BinaryTreeNode(T theData, BinaryTreeNode&lt;T&gt; leftChild,
              BinaryTreeNode&lt;T&gt; rightChild) {
          data = theData;
  
          left = leftChild;
          right = rightChild;
      }
  
      public void levelOrder(
              SortedMap&lt;Integer, List&lt;BinaryTreeNode&lt;T&gt;&gt;&gt; accumulator, int depth) {
  
          accumulator.put(depth, this);// add (this) to accumulator
  
          if (left != null) {
              left.levelOrder(accumulator, depth);// if (left) is not null invoke
                                                  // this method for left
          }
          if (right != null) {
              right.levelOrder(accumulator, depth);// do the same for (right)
          }
  
      }
  }
  </code></pre>