Data Structures and Algorithms
with Object-Oriented Design Patterns in C#![]() ![]() ![]() ![]() ![]() |
A multi-dimensional array
of dimension n
(i.e., an n-dimensional array or simply n-D array)
is a collection of items which is accessed via n subscript expressions.
For example, in C# the element
of the two-dimensional array x
is accessed by writing x[i,j].
The built-in multi-dimensional arrays suffer the same indignities
that simple one-dimensional arrays do:
Array indices in each dimension range from zero to ,
where Length is the array length in the given dimension
and the number of dimensions and the size of each dimension
is fixed once the array has been allocated.
In order to illustrate how these deficiencies of the C# built-in
multi-dimensional arrays can be overcome,
we will examine the implementation of a multi-dimensional array class,
MultiDimensionalArray,
that is based on the one-dimensional array class discussed
in Section .