title: Sorting double with Counting Sort
body: <p>I'm trying to sort double digits with counting sort. Tried to convert all doubles to integer but for some reason nothing happens. My code that sorts intergers. </p>
  
  <pre><code>public static void CountingSort(DataArray items) {
      // O(1)
      int max = items[0];
  
      // O(N)
      for (int i = 0; i &lt; items.Length; i++) {
          if (items[i] &gt; max) {
              max = items[i];
          }
      }   
  
      // Space complexity O(N+K)
      int[] counts = new int[max + 1];
  
      // O(N)
      for (int i = 0; i &lt; items.Length; i++) {
          counts[items[i]]++;
      }
      // O(N+K)
      int j = 0;
      int c = items.Length - 1;
      int current, previous;
      for (int i = 0; i &lt; counts.Length; i++) {
      while (counts[i] &gt; 0) {
          while (c &gt; j) {
              if (items[c] == i) {
              current = items[c];
              while (c != j)
          {
          previous = items[c - 1];
          items.Swap(c, current, previous);
          c--;
          }
      }
      c--;
      }
      j++;
      counts[i]--;
      c = items.Length - 1;
      }
      }
  }
  </code></pre>
  
  <p>Is it even possible to sort double digits with counting sort?</p>