## Multidimensional array in one dimensional array, Data Structure & Algorithms

Assignment Help:

Q. By giving an example show how multidimensional array can be represented in one the dimensional array.

Ans:

Multidimensional array: Multidimensional arrays can be defined as "arrays of arrays". For example, a bidimensional array may be imagined as a bidimensional table made of the elements, all of them of the same uniform data type.

int arr[3][5]; represents a bidimensional array of 3 per 5 elements of the type int. Similarly a three dimensional array such as

int arr[3][4][2]; represent an outer array of the three elements , each of which is a two dimensional array of the four rows, each of which is a one dimensional array of the five elements.

Multidimensional arrays are not restricted to the two or three indices (which means two dimensional or three dimensional). They may contain as many indices as required. Moreover the amount of memory needed for an array quickly increases with the each dimension.
For example: char   arr   [100][365][24][60][60];declaration  would   consume   more   than the  3 gigabytes of the memory.

The memory does not have rows and columns, so whether it is a one dimensional array or two dimensional arrays it does not matter, the array elements are stored linearly in the one continuous chain. For example, the multidimensional array

int arr[3][4][2]= {

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

{ {9,1},{1,2},{3,7},{4,7} },

{ {6,1},{18,19},{20,21},{22,23} },

}; is stored in memory just like the one-dimensional array as follows:

Multidimensional arrays are just an abstraction for the programmers, since we can obtain the same results with an easy array just by placing a factor between its indices.

#### Generic doubly linked list, Your objective is to write a generic doubly lin...

Your objective is to write a generic doubly linked list class called CS228LinkedList that implements the List interface and uses a type variable T. All methods except for subList a

#### Illustrate hls colour model, HLS Colour Model  This model has the doub...

HLS Colour Model  This model has the double-cone representation shown in Figure 3.40. The three colour parameters in this model are called hue (H), lightness (L), and Saturati

#### Optimization Methods, Optimal solution to the problem given below. Obtain t...

Optimal solution to the problem given below. Obtain the initial solution by VAM Ware houses Stores Availibility I II III IV A 5 1 3 3 34 B 3 3 5 4 15 C 6 4 4 3 12 D 4 –1 4 2 19 Re

#### Define the internal path length, Define the Internal Path Length The In...

Define the Internal Path Length The Internal Path Length I of an extended binary tree is explained as the sum of the lengths of the paths taken over all internal nodes- from th

#### Explain np-complete decision problem, a. Determine the result of inserting ...

a. Determine the result of inserting the keys 4,19, 17, 11, 3, 12, 8, 20, 22, 23, 13, 18, 14, 16, 1, 2, 24, 25, 26, 5 in order to an empty B-Tree of degree 3. Only draw the configu

#### Deletion from a red-black tree, Deletion in a RBT uses two main processes, ...

Deletion in a RBT uses two main processes, namely, Procedure 1: This is utilized to delete an element in a given Red-Black Tree. It involves the method of deletion utilized in

#### Balance tree, what is a balance tree?

what is a balance tree?

#### How to measure the algorithm efficiency, How to measure the algorithm's eff...

How to measure the algorithm's efficiency? It is logical to examine the algorithm's efficiency as a function of some parameter n showing the algorithm's input size. Instance

#### #, if two relations R and S are joined, then the non matching tuples of bot...

if two relations R and S are joined, then the non matching tuples of both R and S are ignored in

#### Type of qualitative method, Type of Qualitative Method: Different  qua...

Type of Qualitative Method: Different  qualitative methods are suitable for different  types of study. Quite often we can  combine  qualitative and quantitative  methods. Many