title: How to make double sort integer arrays using C++?
body: <p>I have 3-column integer arrays, whose last 2 elements are for sorting. For example</p>
  <blockquote>
  <p>10 0 1</p>
  <p>11 0 2</p>
  <p>12 1 2</p>
  <p>13 0 1</p>
  </blockquote>
  <p>I want them to become:</p>
  <blockquote>
  <p>10 0 1</p>
  <p>13 0 1</p>
  <p>11 0 2</p>
  <p>12 1 2</p>
  </blockquote>
  <p>The arrays are first sorted according to the 2nd column, and then again according to 3rd column.</p>
  <p>I have over 3000 rows, so I need something also fast. How can you do this in c++?</p>
  <p>Note: The array will be allocated dynamically using the following templates:</p>
  <pre><code>template &lt;typename T&gt;
  T **AllocateDynamic2DArray(int nRows, int nCols){
      T **dynamicArray;
  
      dynamicArray = new T*[nRows];
      for( int i = 0 ; i &lt; nRows ; i++ ){
          dynamicArray[i] = new T[nCols];
          for ( int j=0; j&lt;nCols;j++){
              dynamicArray[i][j]= 0;
          }
      }
      return dynamicArray;
  }
  </code></pre>
  <p>in main,</p>
  <p>int ** lineFilter = AllocateDynamic2DArray(2*numberOfLines,3);</p>