Wrote the code for sorting. Getting timeout error. Any ideas how to get it working (PS:started coding a week ago) : <p>The following code is supposed to do sorting by assigning indexes based on greater or less than. eg for 5,17,13,21,6 5 is greater than 0 numbers, 17 is greater than 3 numbers 13 is greater than 2 number 21 is greater than 4 numbers and 6 is greater than 1 number. so we use these indexes and then place the numbers in new array accordingly. </p>

<pre><code>#include&lt;stdio.h&gt;
        int main()
        {
            int i,j,w[4],z[4],x[4];
            x[0]=0;x[1]=0;x[2]=0;x[3]=0;


           w[0]=1; w[1]=3; w[2]=7; w[3]=15;

           for(i=0; i&lt;4; i++)
           {
               for(j=0; j&lt;4; i++)
                  {    
                      if (w[j] &lt; w[i]) { x[i] = x[i] + 1;}
                  ;}
           ;}

           for(i=0; i&lt;4; i++) {z[x[i]]=w[i];}

           for(i=0; i&lt;4; i++) {printf("%d",z[i]);}

        }
</code></pre>
