title: How to Sort a 2D array?
body: <p>I need help with sorting 2D array. I've got array with two rows</p>
  
  <pre><code>[5, 3, 4, 1, 2]
  [10,20,30,40,50]
  </code></pre>
  
  <p>and I need to sort it to look like this: </p>
  
  <pre><code>[1, 2, 3, 4, 5]
  [40,50,20,30,10]
  </code></pre>
  
  <p>I know how to do that with bubble sort, but I need some faster algorithm, e.g. quicksort.</p>
  
  <p>Here is my bubble sort code</p>
  
  <pre><code>   for (int i = 0; i &lt; length-1; i++) {
           for (int j = 0; j &lt; length-i-1; j++) { 
  
              if (array[0][j] &gt; array[0][j+1]) {
  
                 for (int k = 0; k &lt; 2; k++) {
                 int tmp = array[k][j];
                 array[k][j] = array[k][j+1];
                 array[k][j+1]=tmp;
                 }
             }
         }
      }
  </code></pre>