title: Confusion on quicksort that takes logarithmic space
body: <p>If only the smaller partitioned array is being called how is the larger one sorted? I only see code to change the position of <code>b</code> if done recursively (<code>QS</code> called in <code>if</code> and <code>else</code> statement).</p>
  
  <pre><code> public static void QS(int[] b, int h, int k) {
       int h1= h; int k1= k;
       // invariant b[h..k] is sorted if b[h1..k1] is sorted
       while (b[h1..k1] has more than 1 element) {
           int j= partition(b, h1, k1);
           // b[h1..j-1] &lt;= b[j] &lt;= b[j+1..k1]
           if (b[h1..j-1] smaller than b[j+1..k1])
               QS(b, h, j-1); h1= j+1; 
           else
               QS(b, j+1, k1); k1= j-1; 
       }
  }
  </code></pre>