I am trying to create a recursive solution to a problem which takes a lower-triangular matrix (basically a 2D array in which all elements where column is greater than row is zero). I need to recursively pass smaller and smaller sub-array to the function till I reach an array containing a single element. Also, I do not know the size of array in advance so I dynamically allocated memory with following code:
1 2 3 4
int **a;
a = newint* [l];
for (int i=0;i<l;i++)
*(a+i) = newint[l];
Now I need to recursively pass the smaller sections of the subarray, for example if the array is:
3 0 0 0
7 4 0 0
2 4 6 0
8 5 9 3
Then I need to recurse twice, once on the sub-array:
7 4 0
2 4 6
8 5 9