title: Using Stacks for a Non-Recursive MergeSort?
body: <p>my professor assigned a problem in which we must use Stacks (or Queues) to make a non-recursive MergeSort. The current code is as follows:</p>
  
  <pre><code> private static void sort(Comparable[] a, int[] index, int[] aux, int lo, int hi) {
      if (hi &lt;= lo) return;
      int mid = lo + (hi - lo) / 2;
  
      sort(a, index, aux, lo, mid);
      sort(a, index, aux, mid + 1, hi);
  
      merge(a, index, aux, lo, mid, hi);
  </code></pre>
  
  <p>I'm not sure how to approach this problem, and any help would be appreciated. I know that i must use a while loop to emulate the recursion. But how can I split the actual values? Also, how can I keep track of the middle of the partitioned values?</p>
  
  <p>I am really confused by the problem. Any help would be appreciated! </p>