title: Is this a correct implementation of quicksort?
body: <p>I would like to check if this is a correct implementation of QuickSort, It seems to be doing the job, but Am I missing out anything?</p>
  
  <pre><code>public class QuickSort implements Sorter {
  
  public void sort(Comparable[] items) {
      QuickSort(items, 0, items.length - 1);
  }
  
  static void QuickSort(Comparable[] items, int a, int b) {
      int lo = a;
      int hi = b;
      if (lo &gt;= hi) {
          return;
      }
      Comparable mid = items[(lo + hi) / 2];
      Comparable T;
  
      while (lo &lt; hi) {
          while (items[lo].compareTo(mid)&lt;0) {
              lo++;
          }
          while (mid.compareTo(items[hi])&lt;0) {
              hi--;
          }
          if (lo &lt; hi) {
              T = items[lo];
              items[lo] = items[hi];
              items[hi] = T;
          }
      }
  
      QuickSort(items, a, lo);
      QuickSort(items, lo == a ? lo + 1 : lo, b);
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p><strong><em>fixed:</em></strong></p>
  
  <pre><code>private static void quickSort(Comparable[] items, int a, int b) {
      int i = a;
      int j = b;
  
      Comparable x = items[(a+ b) / 2];
      Comparable h;
  
      do {
          while (items[i].compareTo(x) &lt; 0) {
              i++;
          }
          while (items[j].compareTo(x) &gt; 0) {
              j--;
          }
          if (i &lt;= j) {
              h = items[i];
              items[i] = items[j];
              items[j] = h;
              i++;
              j--;
          }
      } while (i &lt;= j);
  
      if (a &lt; j) {
          quickSort(items, a, j);
      }
      if (i &lt; b) {
          quickSort(items, i, b);
      }
  }
  </code></pre>