Ordering: Difference between revisions

Line 32: Line 32:
First note that <math>\sum_{0}^{k}i = \frac{(k)(k+1)}{2}</math>.
First note that <math>\sum_{0}^{k}i = \frac{(k)(k+1)}{2}</math>.
Thus the number of elements in columns <math>0, ..., x-1</math> is <math>(x)(x+1)/2</math>.   
Thus the number of elements in columns <math>0, ..., x-1</math> is <math>(x)(x+1)/2</math>.   
Thus our formula is <math>z = \frac{x(x+1)}{2} + y</math>
Thus our formula is  
<math display="block">z = \frac{x(x+1)}{2} + y</math>


To calculate the inverse formula:   
To calculate the inverse formula: