title: Can Bitonic Sort handle non-power-of-2 data in a non-recursive implementation ? (without using the method of padding to the power of 2)
body: <p>Below is a pseudocode for a non-recursive implementation of Bitonic sort.</p>
  <p>I can't think of a way to modify the pseudocode to handle data input of any size without using the method of padding the data to the power of 2.</p>
  <pre><code>void impBitonicSort() {
      int i, j, k;
      for (k = 2; k &lt;= N; k = 2 * k) {
          for (j = k &gt;&gt; 1; j &gt; 0; j = j &gt;&gt; 1) {
              for (i = 0; i &lt; N; i++) {
                  int ij = i ^ j;
                  if ((ij) &gt; i) {
                      if ((i &amp; k) == 0 &amp;&amp; a[i] &gt; a[ij]) exchange(i, ij);
                      if ((i &amp; k) != 0 &amp;&amp; a[i] &lt; a[ij]) exchange(i, ij);
                  }
              }
          }
      }
  }
  </code></pre>