In: Computer Science
What is an array data structure?
What is an array index?
What are the benefits of array structures?
What are the drawbacks of array structures?
What is a grid structure?
Give examples of when an array could be used.
Give examples of when a grid could be used.
1. Array is a data structure which can store sequence of homogeneous data types in contigeous location.
2. Array index is numerical value (usually starting from 0) used to access elements in an array e:g if a is an array of 5 elements then a[4] means 5 th element in array.
3. The biggest benefit of Arrays is that arrays provide direct access to elements i:e we can directly any element from an array.
4. Array is static structure i:e arrays are fixed size. The memory which is allocated to array can not be increased or reduced. The elements of array are stored in consecutive memory locations. There are means to create dynamic arrays but internally arrays are static structures.
5. Grid Structure is basically 2 dimensional array which has rows and columns. A rectangular array of squares or rectangles of equal size.
6. Arrays can be used to store multiple elements when the number or size is known in advance e:g to store the daily petrol expenses of car each week we can use array of size 7 for each day.
7. Grid can be used where two dimensional data has to be used. For example storing the marks of each student in a particular subject. I will use an array of 3 columns first column for roll no, sexond for marks.