0% found this document useful (0 votes)
12 views1 page

Data Structures and Array Storage Explained

The document consists of a tutorial on arrays, covering definitions of data structures, their linear and non-linear types, and applications. It includes questions on image processing storage methods, data transformation between Fortran and C, and memory address calculations for 2D arrays. Additionally, it explores the implications of row-major versus column-major storage on performance and memory layout.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views1 page

Data Structures and Array Storage Explained

The document consists of a tutorial on arrays, covering definitions of data structures, their linear and non-linear types, and applications. It includes questions on image processing storage methods, data transformation between Fortran and C, and memory address calculations for 2D arrays. Additionally, it explores the implications of row-major versus column-major storage on performance and memory layout.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Arrays

Tutorial 1:
Q1: Define data structure. What do you mean by Linear and non-linear data structure? Give
example.
Q2: List out the areas in which data structures are applied extensively. Also list the various
operations that can be performed on data structure.

Q3: In image processing, pixels are accessed in both row and column fashion.
Discuss how the choice between row-major and column-major storage can affect image
manipulation performance.

Q4: Suppose you're given a library written in Fortran (uses column-major order), and your C
program (uses row-major order) has to pass 2D arrays to it.
What precautions or transformations would you need to perform to ensure data is interpreted
correctly?

Q5: Consider the following structure


struct test
{
int A[3][2]; //Integer takes-4 bytes
char B[10]; //Char takes-1 bytes
float C[2][2]; // float takes-8 bytes
}struct test * next;
struct test r[20];
If the base address of r is 200. What is the address of C[1,1]?

Q6: Suppose there is an integer array M(5,8), the address of M(0,0), M(0,3) and M(1,2) are 100,
106 and 120 respectively, what is the address of M(4,5)?

Q7: You are told a 2D array M[3][3] is stored starting from memory address 500, and each
element is 4 bytes.
You are given the address of M[1][2] as 548.
Can you deduce whether the array is stored in row-major or column-major order? Show
calculations.

You might also like