Nandhini Posted June 9, 2020 Share Posted June 9, 2020 What is Multi dimensional array in Data structures? Link to comment Share on other sites More sharing options...
Dagl1 Posted June 9, 2020 Share Posted June 9, 2020 Other people will give you much better answers (or provide more information). Have you looked at https://www.w3schools.com/php/php_arrays_multidimensional.asp (first link that came up, the language (PHP) does not matter to understand multi dimensional arrays)? An array contains a collection of elements, such as integers, strings and booleans. Let's say we have: Array = [1,2,3,4] Then Array[0] = 1 and Array[2] = 3 A multidimensional array contains arrays as its elements. MultiDimensionalArray = [ [1,2,3,4], [5,6,7,8], [9,10] ] (this array has 2 dimensions) Then the first position of this MultiDimensionalArray will be MultiDimensionalArray[0] = [1,2,3,4] if we want to access one of the numbers in this array, we would specify a second dimension: MultiDimensionalArray[0][1] = 2. Does this help? Other people will be able to help you further, but I highly recommend reading/searching about these things yourself first and explain the parts that you do not understand, that way people can help you more and you will learn faster. Good luck! 2 Link to comment Share on other sites More sharing options...
Strange Posted June 9, 2020 Share Posted June 9, 2020 14 minutes ago, Dagl1 said: Other people will be able to help you further You have said everything I was going to say Well, one more thing. The "list of lists" or "array of arrays" description is one way of thinking about 2D arrays, and is how many programming languages work. But you can also think of it as an explicit, 2D array: A = [11, 12, 13, 14, 15, 16; 21, 22, 23, 24, 25, 26; 31, 32, 33, 34, 35, 36] That is a 3x6 array. Some languages treat multidimensional arrays like this so you can references elements of the array as A[2,4] (which would equal 24 in this example). And just a bit of terminology. A 1D array is often called a "vector" in mathematics. A 2D (or higher dimensional) array is called a "matrix". In some programming languages, arrays of any number of dimensions are called "tensors". Lists and arrays are very similar concepts. Some languages have either lists or arrays. Some have both, with slightly different properties. Typically, an array has a fixed size while a list can have things added to the end, or inserted in the middle. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now