answersLogoWhite

0


Best Answer

its the method for sorting the multidimensional array.

eg:

consider the matrix: 10 1 3

2 7 5

8 6 4

row-major order: 1 3 10

2 5 7

4 6 8

column major order: 2 1 3

8 6 4

10 7 5

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

7y ago

Row-major and column-major describe the two ways in which a multi-dimensional array can be laid out in memory. Array layout is critical when passing arrays between two programs written in different languages because every programming language has its own "native" array layout:

Row-major languages include:

  • C/C++/Objective-C (for all C-style arrays)
  • C#/CLI/.Net
  • Mathematica
  • Pascal
  • PL/I
  • Speakeasy
  • SAS

Column-major languages include:

  • Fortran
  • OpenGL and OpenGL ES
  • MATLAB
  • Gnu-Octave
  • S-Plus
  • R
  • Julia
  • Scilab

We cannot change the native layout of a language, however we can switch from one memory layout to another simply by transposing the array dimensions.

Consider the following array:

1 2 3 4

5 6 7 8

In C (a row-major language), we would declare this array as follows:

int x[2][4] = {{1, 2, 3, 4}, {5, 6, 7, 8}};

Once initialised, the elements will be laid out in contiguous memory addresses as follows:

1 2 3 4 5 6 7 8

We call this row-major because the elements are grouped by row:

{1, 2, 3, 4}, {5, 6, 7, 8}

In a column-major programming language, the same array would be laid out as follows:

1 5 2 6 3 7 4 8

Here, the elements are grouped by column:

{1, 5}, {2, 6}, {3, 7}, {4, 8}

To transform our row-major array into a column-major array we simply transpose the array:

int y[4][2]; // transposed array

for (row=0; row<2; ++row)

for (col=0; col<4; ++col)

y[col][row]=x[row][col];

Once executed, the memory layouts of x and y are as follows:

x = 1 2 3 4 5 6 7 8

y = 1 5 2 6 3 7 4 8

Note that y is not a column-major array (it is a row-major array because the language is row-major) however the memory layout is the layout expected of a column-major language.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What you mean by row major and column major?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How to resize the row and column in Microsoft Excel?

Highlight the row or column you want to resize by clicking on the top or left column, then click on format either row or column, then click on either heighth or width. A task box will appear, just enter the highth or width you want. Another option is to autofit.


How are two dimensional arrays represented in memory. Explain how address of an element is calculated in a two dimensional array?

The memory of a computer is linear and not a matrix like a 2D array. So, the elements of the array are stored either by row, called "row-major", or by column, called "column-major". Row-major order is used most notably in C and C++ during static declaration of arrays. In C, since the length of each row is always known, the memory can be filled row one row at a time, one after the other. Example: a[i][j] = 1 2 3 4 5 6 7 8 9 Representation in the memory: In row-major: 1 2 3 4 5 6 7 8 9 In column-major: 1 4 7 2 5 8 3 6 9 Address calculation of an element: Row-Major : addr (i,j) = B + W * ( Nc * (i - Lr) + (j-Lc) ) Col-Major : addr (i,j) = B + W * ( (i - Lr) + Nr * (j-Lc) ) i,j = subscript number. B = Base address W = width (size) of each element Nc = Number of Columns Nr = Number of Rows Lc = Lower-bound of Column Lr = Lower-bound of Row In above example, for element (6), i.e., a(1,2) in row-major or a(2,1) in col-major, B = 200 (say) W = 2 Lr=Lc=0 Nc=Nr=3 addr (1,2) = 210; addr (2,1) = 210


How does one draw a triangle in C console?

#include&lt;stdio.h&gt; void main() { int row,column,add,sub,h,noofrows,noofcolumns,j,finish; printf("how many rows do you want in your triangle\n"); scanf("%d",&amp;noofrows); noofcolumns=noofrows-1; for(row=1;row&lt;=noofrows-1;row=row+1) { for(column=-noofcolumns;column&lt;=noofcolumns;column=column+1) { add=row+column; sub=row-column; if(add==1sub==1) { printf("*"); } else { printf(" "); } } printf("\n"); } finish=((noofrows+noofrows)-1); for(j=1;j&lt;=finish;j=j+1) { printf("*"); } scanf("%d",&amp;h); }


How tables inserted into HTML tags?

Basic table example: &lt;html&gt; &lt;head&gt; &lt;title&gt;My Table Page&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;table border=1&gt; &lt;th&gt;Heading 1&lt;/th&gt; &lt;th&gt;Heading 2&lt;/th&gt; &lt;th&gt;Heading 3&lt;/th&gt; &lt;tr&gt; &lt;td&gt;Row 1, Column 1&lt;/td&gt; &lt;td&gt;Row 1, Column 2&lt;/td&gt; &lt;td&gt;Row 1, Column 3&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Row 2, Column 1&lt;/td&gt; &lt;td&gt;Row 2, Column 2&lt;/td&gt; &lt;td&gt;Row 2, Column 3&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Row 3, Column 1&lt;/td&gt; &lt;td&gt;Row 3, Column 2&lt;/td&gt; &lt;td&gt;Row 3, Column 3&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt;


A worksheet's row and column structure can be used to organize and store a what?

table

Related questions

What is insertion of a row or column?

If you mean intersection, then the answer is a cell. If you mean insertion, then it is putting an extra row or column into a worksheet.


What formula would be used to add two cells together after the equal sign?

column#row+column#column#row#


What is the cell reference A1 for Microsoft Excel?

A1 is the first cell, in the first column and the first row: Column A, row 1.A1 is the first cell, in the first column and the first row: Column A, row 1.A1 is the first cell, in the first column and the first row: Column A, row 1.A1 is the first cell, in the first column and the first row: Column A, row 1.A1 is the first cell, in the first column and the first row: Column A, row 1.A1 is the first cell, in the first column and the first row: Column A, row 1.A1 is the first cell, in the first column and the first row: Column A, row 1.A1 is the first cell, in the first column and the first row: Column A, row 1.A1 is the first cell, in the first column and the first row: Column A, row 1.A1 is the first cell, in the first column and the first row: Column A, row 1.A1 is the first cell, in the first column and the first row: Column A, row 1.


How does cells get their address?

It is based on the column and row the cell is in. First the column letter(s) and then the row number. So a cell in Column G, Row 498 for example, is cell G498.It is based on the column and row the cell is in. First the column letter(s) and then the row number. So a cell in Column G, Row 498 for example, is cell G498.It is based on the column and row the cell is in. First the column letter(s) and then the row number. So a cell in Column G, Row 498 for example, is cell G498.It is based on the column and row the cell is in. First the column letter(s) and then the row number. So a cell in Column G, Row 498 for example, is cell G498.It is based on the column and row the cell is in. First the column letter(s) and then the row number. So a cell in Column G, Row 498 for example, is cell G498.It is based on the column and row the cell is in. First the column letter(s) and then the row number. So a cell in Column G, Row 498 for example, is cell G498.It is based on the column and row the cell is in. First the column letter(s) and then the row number. So a cell in Column G, Row 498 for example, is cell G498.It is based on the column and row the cell is in. First the column letter(s) and then the row number. So a cell in Column G, Row 498 for example, is cell G498.It is based on the column and row the cell is in. First the column letter(s) and then the row number. So a cell in Column G, Row 498 for example, is cell G498.It is based on the column and row the cell is in. First the column letter(s) and then the row number. So a cell in Column G, Row 498 for example, is cell G498.It is based on the column and row the cell is in. First the column letter(s) and then the row number. So a cell in Column G, Row 498 for example, is cell G498.


What are the two parts of the cell identifier in excel?

The column reference, which is one or more letters and the row number. So C20 is column C, row 20. DG321 is column DG, row 321.The column reference, which is one or more letters and the row number. So C20 is column C, row 20. DG321 is column DG, row 321.The column reference, which is one or more letters and the row number. So C20 is column C, row 20. DG321 is column DG, row 321.The column reference, which is one or more letters and the row number. So C20 is column C, row 20. DG321 is column DG, row 321.The column reference, which is one or more letters and the row number. So C20 is column C, row 20. DG321 is column DG, row 321.The column reference, which is one or more letters and the row number. So C20 is column C, row 20. DG321 is column DG, row 321.The column reference, which is one or more letters and the row number. So C20 is column C, row 20. DG321 is column DG, row 321.The column reference, which is one or more letters and the row number. So C20 is column C, row 20. DG321 is column DG, row 321.The column reference, which is one or more letters and the row number. So C20 is column C, row 20. DG321 is column DG, row 321.The column reference, which is one or more letters and the row number. So C20 is column C, row 20. DG321 is column DG, row 321.The column reference, which is one or more letters and the row number. So C20 is column C, row 20. DG321 is column DG, row 321.


Is excal is formed due to intersectin tof two rows and columns?

Where a column and row intersect, you will get a cell on a spreadsheet.Where a column and row intersect, you will get a cell on a spreadsheet.Where a column and row intersect, you will get a cell on a spreadsheet.Where a column and row intersect, you will get a cell on a spreadsheet.Where a column and row intersect, you will get a cell on a spreadsheet.Where a column and row intersect, you will get a cell on a spreadsheet.Where a column and row intersect, you will get a cell on a spreadsheet.Where a column and row intersect, you will get a cell on a spreadsheet.Where a column and row intersect, you will get a cell on a spreadsheet.Where a column and row intersect, you will get a cell on a spreadsheet.Where a column and row intersect, you will get a cell on a spreadsheet.


What does a spilt double arrow allow you to do when positioned between two column or row heading?

It enables you to change the width of a column, or the height of a row. It changes the width of the column to the left or the height of the row above.It enables you to change the width of a column, or the height of a row. It changes the width of the column to the left or the height of the row above.It enables you to change the width of a column, or the height of a row. It changes the width of the column to the left or the height of the row above.It enables you to change the width of a column, or the height of a row. It changes the width of the column to the left or the height of the row above.It enables you to change the width of a column, or the height of a row. It changes the width of the column to the left or the height of the row above.It enables you to change the width of a column, or the height of a row. It changes the width of the column to the left or the height of the row above.It enables you to change the width of a column, or the height of a row. It changes the width of the column to the left or the height of the row above.It enables you to change the width of a column, or the height of a row. It changes the width of the column to the left or the height of the row above.It enables you to change the width of a column, or the height of a row. It changes the width of the column to the left or the height of the row above.It enables you to change the width of a column, or the height of a row. It changes the width of the column to the left or the height of the row above.It enables you to change the width of a column, or the height of a row. It changes the width of the column to the left or the height of the row above.


What does''C3'' MEAN ON EXCEl 07?

C3 could refer to the cell in column C, row 3.C3 could refer to the cell in column C, row 3.C3 could refer to the cell in column C, row 3.C3 could refer to the cell in column C, row 3.C3 could refer to the cell in column C, row 3.C3 could refer to the cell in column C, row 3.C3 could refer to the cell in column C, row 3.C3 could refer to the cell in column C, row 3.C3 could refer to the cell in column C, row 3.C3 could refer to the cell in column C, row 3.C3 could refer to the cell in column C, row 3.


Why do they call a column a cell in Microsoft Excel?

A column is not called a cell in Microsoft Excel. A column is a group of vertically arranged cells, a row being a horizontal group of cells. A cell is created where a column and row intersect, and its address is take from the column and row that it is in.A column is not called a cell in Microsoft Excel. A column is a group of vertically arranged cells, a row being a horizontal group of cells. A cell is created where a column and row intersect, and its address is take from the column and row that it is in.A column is not called a cell in Microsoft Excel. A column is a group of vertically arranged cells, a row being a horizontal group of cells. A cell is created where a column and row intersect, and its address is take from the column and row that it is in.A column is not called a cell in Microsoft Excel. A column is a group of vertically arranged cells, a row being a horizontal group of cells. A cell is created where a column and row intersect, and its address is take from the column and row that it is in.A column is not called a cell in Microsoft Excel. A column is a group of vertically arranged cells, a row being a horizontal group of cells. A cell is created where a column and row intersect, and its address is take from the column and row that it is in.A column is not called a cell in Microsoft Excel. A column is a group of vertically arranged cells, a row being a horizontal group of cells. A cell is created where a column and row intersect, and its address is take from the column and row that it is in.A column is not called a cell in Microsoft Excel. A column is a group of vertically arranged cells, a row being a horizontal group of cells. A cell is created where a column and row intersect, and its address is take from the column and row that it is in.A column is not called a cell in Microsoft Excel. A column is a group of vertically arranged cells, a row being a horizontal group of cells. A cell is created where a column and row intersect, and its address is take from the column and row that it is in.A column is not called a cell in Microsoft Excel. A column is a group of vertically arranged cells, a row being a horizontal group of cells. A cell is created where a column and row intersect, and its address is take from the column and row that it is in.A column is not called a cell in Microsoft Excel. A column is a group of vertically arranged cells, a row being a horizontal group of cells. A cell is created where a column and row intersect, and its address is take from the column and row that it is in.A column is not called a cell in Microsoft Excel. A column is a group of vertically arranged cells, a row being a horizontal group of cells. A cell is created where a column and row intersect, and its address is take from the column and row that it is in.


Which column and row is a cell in?

A cell can be in any column and row. The address (e.g. A3) will tell you which column (A) and which row (3).


How does column and row header appears in a cell?

The column and row headers appear at the start of a row or top of a column, not in a cell. The address of a cell is based up the column and row. So, for example, cell G45 is on column G and row 45.


What does A1 mean in spreadsheets?

It is the cell in column A and row 1.