6,307 views

1 Answer

3 votes
3 votes

In a row-major order, elements which are stored in adjacent locations constitute a row, whereas in a column-major order the elements which are stored in adjacent locations constitute a column.

Coming to the above example, if the order was column-major order, then a[1][1] and a[2][1] would be adjacent memory locations. However since &a[1][1] is 1000 and &a[2][1] is 1010, clearly this is not column-major order.

Therefore the answer should be row-major, with number of columns equaling 4, ie, array[] of array[4] of int. I have not come across "matrix major" order before. Wikipedia has a nice explanation on differences between row and column major order: https://en.wikipedia.org/wiki/Row-_and_column-major_order

Related questions

0 votes
0 votes
2 answers
1
viral8702 asked Sep 21, 2023
275 views
The Total Combinations Possible of Min heap with 8 Distinct elements are ?
0 votes
0 votes
1 answer
2
iamdeepakji asked Jan 27, 2019
265 views
If there is negative edge cycle then dijkstra algorithm will give correct path or not same thing about bellman ford also?Bellman ford always halts or not?
0 votes
0 votes
1 answer
3
iamdeepakji asked Dec 27, 2018
384 views
Please solve this by taking some exampleBack edgecross edgetree edgeThankyou.