I have a more mathematical rather than a computational doubt.
We assume that we have a square matrix M of dimension n²
, where n
is any integer greater than zero. By traversing this array, assigning j
as row index and i
to column indexes, what is the complexity of the algorithm if I consider ij
only when i>j
?
Below the algorithm demonstration:
for i=0; i<n-1; i++:
for j=i+1; i<n; j++:
if i>j:
////cont..
I want to know what the function is to determine, from n
, how many times if
will be checked. In other words, how many elements are there in the triangular matrix below the diagonal.
* I know it's a pretty stupid question, but I completely forgot how to find it.