Complicated title for a simple problem: I have list
a = {{1, 3, 5, 2}, {2, 6, 2}, {3, 5, 6, 1, 2}, {4, 2}}
In which the first element of each sublist is basically an index. The following values are the actual data. Then I want to add data to this list, e.g.,:
b = {{2, 1}, {4, 3}}
Which means that to the list with the index '2' the '1' should be added and the list with the index '4' the '3' should be added, so the result reads:
{{1, 3, 5, 2}, {2, 6, 2, 1}, {3, 5, 6, 1, 2}, {4, 2, 3}}
I found a couple of rather complicated, i.e., time consuming solutions involving loops. However, the actual datset is huge and is part of a numerical simulation, i.e., this procedure needs to be very fast.