title: How to traverse in decimal search tree? (Java) (has at most 10 children instead of 2)
body: <p>I was wondering how do you actually traverse the decimal search tree?
  This is given by my teacher</p>
  
  <blockquote>
    <p>A decimal search tree contains unique values just like a binary search tree, but instead of having at most two children each node has at most ten children.If the objects being saved in the tree have a sorting key that is a non-negative whole number with a known maximum number of digits (k), then every operation reduces to O(k), because each layer of the tree represents a different digit in the key. The layers of the tree are in Most Significant Digit (MSD) order, with the most significant digit at the top and the least significant digit at the bottom of the tree.Eachnode of a decimal search tree ismade up of a value and a 10-element array of children. All branch nodes have a null value, and allleaf nodesthat contain a non-null valuehave a children arrayfilled with nulls. This puts all of the actual data at the lowest level in the tree. </p>
  </blockquote>
  
  <ul>
  <li>contains(key) –returns true if a value with the given key exists in the tree, false if not</li>
  <li>get(key) –returns the value at the given key, or null if it does not exist</li>
  <li>etc.</li>
  </ul>
  
  
  
  <pre><code>private class DecimalNode&lt;E&gt; {
  
      /**
       * the value stored in this node - will be null for all nodes except
       * the lowest-level leaf nodes
       */
      public E value;
  
      /**
       * the array used to store the children of this node
       */
      public DecimalNode[] children;
  
      /**
       * Default constructor.
       */
      public DecimalNode() {
          children = new DecimalNode[10];
      }
  
      /**
       * A convenience method to create a new node at the given
       * index of the current node. 
       * 
       * @param index the index of the children array where the new
       * node should be stored
       */
      public void makeChild(int index) {
          children[index] = new DecimalNode();
      }
  </code></pre>
  
  <p>I am working on contains and get method. The constructor is given by my teacher.</p>
  
  <pre><code>/**
       * Constructor.
       * 
       * @param digitCount the largest number of digits a sorting key will
       * contain in this sorted decimal map
       */
      public SortedDecimalMap(int digitCount) {
          root = new DecimalNode();
          this.digitCount = digitCount;
      }
  
  @Override
  public boolean contains(int key) {
      DecimalNode node = root;
      for(int i = 0; i &lt; digitCount; i++)
      {
          if (node.children[i].equals(key)){
              return true;
          }
      }
      return false;
  }
  
  @Override
  public E get(int key) {
      DecimalNode node = root;
      for (int i = 0; i &lt; digitCount; i++) {
              if (node.children[i].children[key] != null) {
                  return  (E) node.value;
              }
      }
      return null;
  }
  </code></pre>
  
  <p>I have no idea how to traverse through the tree</p>