answersLogoWhite

0


Best Answer

Multi-dimensional arrays are accessed using more than one index: one for each dimension. Multidimensional indexing can be reduced internally to linear indexing; for example, a two-dimensional array with 6 rows and 5 columns is typically represented by a one-dimensional array of 30 elements.

User Avatar

Wiki User

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

Wiki User

7y ago

Multi-dimensional data structures are simply data structures that have one or more dimensions. The simplest such structure has one dimension and is akin to a list with one item per row, such that all items are of the same type but hold different values (duplicate values are permitted if required). We typically represent one dimensional structures as an array as this offers the most compact storage with constant-time random-access to any element in the array. Given that every element is of the same type, they are also of the same length (in bytes), thus given the address of any one element in the array (typically the first element) we can calculate the relative address of any other element in the array from its zero-based index.

A two-dimensional array is often imagined as being a table of elements with rows and columns, however it's best to always think in terms of a one-dimensional array. For instance, a table is just a one-dimensional array of row elements where every row element is a one-dimensional array of data elements. If we extend into three dimensions, every element of every row simply becomes another one-dimensional array.

The number of data elements we can store in a multi-dimensional array is the product of its dimensions. Thus a three-dimensional array of order 3 * 4 * 5 has 60 elements in total. We could just as easily model this array as a one-dimensional array of 60 elements (at the machine level, that is precisely how it would be represented), however dividing the array into two or more dimensions allows us to navigate the array as if it were really separate arrays. in this case, the array is divided into 3 separate arrays (the first dimension), each containing 20 elements, and those 20 elements are further divided into 4 arrays of 5 elements each.

Although array elements must be of the same type, it is possible to have elements of different lengths. The simplest such structure is an array of variable-length strings. Each string is itself an array (of character types), thus the structure is two dimensional. However, rather than being represented as an array of arrays (of the same length), it is represented as an array of pointers to arrays (of variable length). If the strings are represented as null-terminated arrays, we do no need to keep track of the individual string lengths because the null-terminator marks the end of each string. All we really need to know is the start address of each string and the one-dimensional array of pointers alone provides that information.

It is also possible to create multi-dimensional structures using lists instead or arrays, or even combining lists with arrays, such as a list of arrays and/or an array of lists. However, it's best to keep our data structures as simple as possible (and no simpler), with optimal performance and memory consumption. With that in mind, arrays should always be considered the default container unless you have good reason to choose another container.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

A multi dimensional array is an array that can be compared to a table. It has rows and columns.

1 2 3

4 5 6

7 8 9

The above is a 2 dimensional array. It has 3 rows and 3 columns.

The above can also be considered as an array of arrays. A one dimensional array in which each array element in turn is another array that has 3 elements.

The values in the array can be accessed by specifying their location.

For example: value at location (1,2) is 3 and value at location (2,0) is 4 and so on...

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

It provides a natural extension of ideas.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the benefits of multidimensional arrays?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Does Java support multidimensional arrays?

Yes, Java supports multidimensional Arrays.Syntax isint[ ][ ] aryNumbers = new int[x][y];x represents number of rowsy represents number of columns


What is multidimensional array in c plus plus?

A multidimensional array in C or C++ is simply an array of arrays, or an array of an array of arrays, etc. for however many dimensions you want. int a; // not an array int a[10]; // ten int a's int a[10][20]; // twenty int a[10]'s, or 200 int a's int a[10][20][30]; // and so on and so forth...


What is multidimensional arrays?

A two-dimensional array is the simplest multi-dimensional array and is implemented as a one-dimensional array where every element is itself a one-dimensional array. We can imagine a two-dimensional array as being a table of rows and columns where every row is an array in its own right. A three-dimensional array is simply a one-dimensional array of two-dimensional arrays, which can be imagined as being an array of tables. Extending the concept, a four-dimensional array is a table of tables. Multi-dimensional arrays may be jagged. That is, a two-dimensional array may have rows of unequal length. Unlike regular arrays, jagged arrays cannot be allocated in contiguous memory. Instead, we use the outer array (the first dimension) to store pointers to the inner arrays. An array of strings (character arrays) is an example of a two-dimensional jagged array.


How do you pass an array as a parameter?

AnswerUnfortunately your question is to broad. All progamming languages vary in the way things are done. I will just give a general way of doing it.You have to pass the multidimensional array into the function by including it with calling the function. On the receiving end you have to declare another multidimensional array so the information can be passed into it. Depending on the language, you may not be passing in a multidimensional array, instead that array may be stored in an object which you can pass instead.Hope this helps some.-Ashat-in C, when passing two dimensional arrays the compiler needs to know the width so it can calculate memory offsets.passing a 2d array of width 4:voidFunc(type array[][4]);


Explain how Multidimensional Arrays are used in a Visual Basic application?

Creating a Visual Basic Multidimensional Array Declaring a multidimensional array requires both the number of rows and columns to be defined when the array is created. As with standard arrays, multidimensional arrays are declared using the Dimkeyword: Dim strBooks(4, 2) As String The above Visual Basic code excerpt creates a two dimensional String array of 5 rows and 2 columns. Assigning Values to Multidimensional Array Values are assigned to array elements by specifying the index into each dimension. For example, in a two dimensional array, 0, 0 will references the element in the first column of the first row of the array. The following code initializes each element of our array: Dim strBooks(4, 1) As String strBooks (0, 0) = "Learning Visual Basic" strBooks (0, 1) = "John Smith" strBooks (1, 0) = "Visual Basic in 1 Week" strBooks (1, 1) = "Bill White" strBooks (2, 0) = "Everything about Visual Basic" strBooks (2, 1) = "Mary Green" strBooks (3, 0) = "Programming Made Easy" strBooks (3, 1) = "Mark Wilson" strBooks (4, 0) = "Visual Basic 101" strBooks (4, 1) = "Alan Woods" The above example creates a two dimensional array of 5 rows (remember that indexing starts at 0 so this array have elements from 0 to 4 inclusive) and two columns. Column 1 is the book title and column 2 the author.Answerer 1 Multidimensional arrays are used as follows:-Dim a(m,n) as integerfor putting valuefor i = 1 to mfor j = 1 to na(i , j) = val(inputbox("Enter the value"))s = s & a(i , j) & " "next js = s & vbcrlfnext i

Related questions

Does Java support multidimensional arrays?

Yes, Java supports multidimensional Arrays.Syntax isint[ ][ ] aryNumbers = new int[x][y];x represents number of rowsy represents number of columns


What is multidimensional array in c plus plus?

A multidimensional array in C or C++ is simply an array of arrays, or an array of an array of arrays, etc. for however many dimensions you want. int a; // not an array int a[10]; // ten int a's int a[10][20]; // twenty int a[10]'s, or 200 int a's int a[10][20][30]; // and so on and so forth...


How do you use the word multidimensional in a sentence?

Multidimensional means having many dimensions. Here are some sentences.He has a multidimensional personality; he's a very complex person.The scientist made a device that allowed multidimensional travel.This is a multidimensional problem.


What is multidimensional arrays?

A two-dimensional array is the simplest multi-dimensional array and is implemented as a one-dimensional array where every element is itself a one-dimensional array. We can imagine a two-dimensional array as being a table of rows and columns where every row is an array in its own right. A three-dimensional array is simply a one-dimensional array of two-dimensional arrays, which can be imagined as being an array of tables. Extending the concept, a four-dimensional array is a table of tables. Multi-dimensional arrays may be jagged. That is, a two-dimensional array may have rows of unequal length. Unlike regular arrays, jagged arrays cannot be allocated in contiguous memory. Instead, we use the outer array (the first dimension) to store pointers to the inner arrays. An array of strings (character arrays) is an example of a two-dimensional jagged array.


How do you pass an array as a parameter?

AnswerUnfortunately your question is to broad. All progamming languages vary in the way things are done. I will just give a general way of doing it.You have to pass the multidimensional array into the function by including it with calling the function. On the receiving end you have to declare another multidimensional array so the information can be passed into it. Depending on the language, you may not be passing in a multidimensional array, instead that array may be stored in an object which you can pass instead.Hope this helps some.-Ashat-in C, when passing two dimensional arrays the compiler needs to know the width so it can calculate memory offsets.passing a 2d array of width 4:voidFunc(type array[][4]);


What is multidimentional array?

Arrays having more than one dimension is known as multi-dimensional arrays. Multi-dimensional arrays is also known as arrays-of-arrays.


What is a multidimentional array?

Arrays having more than one dimension is known as multi-dimensional arrays. Multi-dimensional arrays is also known as arrays-of-arrays.


What is a PHP function that can sort arrays by other arrays?

You cannot sort arrays by other arrays; that wouldn't make sense, anyway.


Explain how Multidimensional Arrays are used in a Visual Basic application?

Creating a Visual Basic Multidimensional Array Declaring a multidimensional array requires both the number of rows and columns to be defined when the array is created. As with standard arrays, multidimensional arrays are declared using the Dimkeyword: Dim strBooks(4, 2) As String The above Visual Basic code excerpt creates a two dimensional String array of 5 rows and 2 columns. Assigning Values to Multidimensional Array Values are assigned to array elements by specifying the index into each dimension. For example, in a two dimensional array, 0, 0 will references the element in the first column of the first row of the array. The following code initializes each element of our array: Dim strBooks(4, 1) As String strBooks (0, 0) = "Learning Visual Basic" strBooks (0, 1) = "John Smith" strBooks (1, 0) = "Visual Basic in 1 Week" strBooks (1, 1) = "Bill White" strBooks (2, 0) = "Everything about Visual Basic" strBooks (2, 1) = "Mary Green" strBooks (3, 0) = "Programming Made Easy" strBooks (3, 1) = "Mark Wilson" strBooks (4, 0) = "Visual Basic 101" strBooks (4, 1) = "Alan Woods" The above example creates a two dimensional array of 5 rows (remember that indexing starts at 0 so this array have elements from 0 to 4 inclusive) and two columns. Column 1 is the book title and column 2 the author.Answerer 1 Multidimensional arrays are used as follows:-Dim a(m,n) as integerfor putting valuefor i = 1 to mfor j = 1 to na(i , j) = val(inputbox("Enter the value"))s = s & a(i , j) & " "next js = s & vbcrlfnext i


An array of array can be created in java?

Yes. int[][] as; // this will define an array of arrays of integers Multidimensional arrays, remember, are simply arrays of arrays. So a two-dimensional array of type int is really an object of type int array (int []), with each element in that array holding a reference to another int array. The second dimension holds the actual int primitives. The following code declares and constructs a two-dimensional array of type int: int[][] myArray = new int[3][]; Notice that only the first brackets are given a size. That's acceptable in Java, since the JVM needs to know only the size of the object assigned to the variable myArray.


What do arrays eat?

Arrays are reported to be omnivoire.


Janet learned to speak as a toddler. At the same time she grew taller. This is an example of how development is?

multidimensional. (apex)