Hi!
What would be the most effective way to do the following:

Given a certain data input (two lists with one number each) I need to create this table below.
Logic is simple, every time a certain number appears, it adds +1 to the respective column

You can have a flat list and instead of using a 1d index you can use a 2d index and convert it to 1d and viceversa to use the list components. If i and j are the indices in 2d, U the number of columns, and index the index in 1d, you can convert it using:

A Matrix is more suitable to visualize the results.

I have a â€śsimilarâ€ť thingy in C#: pay attention to the way used in order to visual â€śmapâ€ť a Matrix to some Tree (the demo graph, that is). Reason is that the Matrix is top left to right while a Tree (in most of cases) is bottom left to right (if this makes any sense).

Thing isâ€¦I still canâ€™t figure out how to generate the internal data of the matrix (or the 1d list) where the N row is the (N-1) row plus the input dataâ€¦

I put the table for visual reference.
I have 10 columns, labelled from 0 to 9. On row 0, all values are 0
On row 1, values from data input are 7 and 4. So it adds +1 to the column 7 and 4.
On row 2, values are 4 and 1. It adds +1 to the column 4 and 1.

In general, if i=rows and j= columns --> Cell [i,j] = Cell [i-1,j] + 1 (if input data [i] = j).

I guess I could transform input data into a [1,10] vector with 1s and 0s to work more easilyâ€¦