array vs vector problem

Please help me to solve my problem. There is an array of integers (tab[4][4]). I need to extract elements form this array (into a vector) in the following order:
a00, a11, a10, a11, a20, a11.
Did I read that right? You need 4 of the 16 elements: a00, a10, a20, and a11?
In my post I used array-like indexing (first digit row, second digit column). Sequential indexing is: a00, a05, a04, a05, a08, a05. Important is element a11 (here a05), because I construct vector with 6 elements and element a11 (a05) builds its second column.
I have to calculate lowest incremental sum of tab[4][4] elements to cross from tab[4][4] column 0 to 3. First column elements a00, a04, a08 have their path leading through element a05. That is why I am doing this.
Hello mierzvoj,

With out seeing the code that you have I can only guess at what you want.

Maybe something like: vectorName.push_back(a[row][col]);

I do not follow this:
First column elements a00, a04, a08 have their path leading through element a05.

The array "a[4][4]" would look like"

constexpr size_t MAXROW{ 4 };
constexpr size_t MAXCOL{ 4 };

	{1, 2, 3, 4};
	{5, 6, 7, 8},
	{9, 10, 11, 12},
	{13, 14, 15, 16}

That makes "a04", "a08" and "a05" outside the boundary of the array. Unless I am misunderstanding something.

Hi Andy
array looks like this:
1 > 2 > 3 > 4
5 > 6 7 8
9 > 10 11 12

13 14 15 16
now, I move from col 0 to 3, adding up array elements. Task is to find path, that constitutes the lowest sum possible. like 1 + 2 + 3 + 4 = 10. We move forward or forward-diagonal only.
1+6+3+4=14. I thought, vector might be helpful, to construct arrays like this
1 6
5 6
9 6,
1 6 7
5 6 7
9 6 7
to store all possible move patterns and
to solve the task.
mierzvoj wrote:
to store all possible move patterns

You are joking?

Try Dijkstra's algorithm.
Hi Lastchance
my Father in Law solved it in Mathlab this way. Now I try in cpp. Sorry, for being awkward, this is my third month with cpp.
Topic archived. No new replies allowed.