Sorting 2D Vector Array Based On a Column
<p>I have a <strong>2d vector array</strong> which contains :</p>

<pre><code>row id   r   b   main  
   1     0   26   3
   2     1   11   2
   3     1   46   4
   4     2   26   1
   5     3   11   2
</code></pre>

<p>I want to sort every row  based on its <code>"main"-column</code> value
smaller  <code>"main"-column</code>.
smaller value <code>=&gt;</code> the entire row should be on the top.</p>

<p>if there is tow rows or more and there <code>"main"-column</code> have the same value, I want to check <code>"r"-column</code>.
 smaller value <code>=&gt;</code> the entire row should be on the top.</p>

<p>after sorting it will look like this:</p>

<pre><code>row id   r   b   main  
   4     2   26   1
   2     1   11   2
   5     3   11   2
   1     0   26   3
   3     1   46   4
</code></pre>