Monday, August 24, 2009

DS assignment 2

Anand Engineering College, Agra Department of Computer Science
Apoorv Garg Page 1 of 1
Data Structures Using C (ECS-302)
Home Work Assignment 2
Q. 1. Define:
a. Data
b. Information
Q. 2. Explain the term ‘Data Structure’.
Q. 3. Describe in brief the various data structures.
Q. 4. Give the difference between linear and non-linear data structures with examples.
Q. 5. Define an array. Explain: Traversing of Linear Arrays.
Q. 6. Consider the linear array A(5:50), whose base address is 300 and the number of words
per memory cell is 4. Find the address of A[15].
Q. 7. Give a procedure to find the average of the values stored in a linear array A.
Q. 8. Write a program in C to sort a set of 100 complex numbers into ascending order of their
absolute values. Real and imaginary part of all the complex numbers are integers.
Absolute value of a complex number x + iy is defined as 2 2 x + y . Choose suitable
data structure to represent complex numbers.
Q. 9. Give the time-complexity analysis of the two algorithms (discussed in the class) for
deleting duplicate numbers of a linear array.
Q. 10. Calculate the address of X[10][10] in an array X[20][50]. Assume the base address to be
2000 and that each element requires 4 bytes of storage, and that the array is stored in:
a. Row major
b. Column major
Q. 11. Let A be an N x N square matrix array. Write modules (algorithms) for the following:
a. Find the number of elements in the matrix
b. Find the number NUM of non-zero elements in A.
c. Find the product PROD of the diagonal elements (a11, a22, a33, …, aNN).
d. Find the summation SUM of the diagonal elements.
Q. 12. Derive the formula to find physical address of an element of three dimensional array
stored in row major order.

No comments:

Post a Comment