DON BOSCO INSTITUTE OF TECHNOLOGY
Kumbalagodu, Bangalore-560074
DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING
Subject: DATA STRUCTURES AND APPLICATIONS Sub Code: 18CS32
ASSIGNMENT – 1
Group – 1
1. Differentiate between Structures and Union (Mention at least 5 differences).
2. Explain with example and tracing i) Insertion and ii) Deletion in an array.
3. Suppose each student in a class of 25 students is given 4 tests, assume the students are
numbered from 1 to 25, and the test scores are assigned in the 25 X 4 matrix called SCORE.
Suppose Base (SCORE) = 200, w=4 and the programming language uses row-major order to store
this 2D array, then find the address of 3rd test of 12th student i.e. SCORE (12, 3).
4. Write the postfix form of the following expression using stack method.
a. (a + b) * d + e / ( f + a * d ) + c
b. ((a/ (b – c + d)) * (e – a) * c)
5. Write a program to implement PATTERN MATCHING Algorithm.
Group – 2
1. What is sparse matrix and show with a suitable example for sparse matrix representation storing
as triples. Give a sample function to read sparse matrix.
2. Write an algorithm to evaluate a postfix expression. Evaluate the following postfix expression
ABC + * D E / - where A=5, B=6, C=2, D=12 and E=4.
3. Write a program to convert given infix to postfix expression.
4. Write a program to implement ARRAY Operations.
5. Write a function to transpose the given sparse matrix. Express the given sparse matrix as triplets
and find its transpose.
10 0 0 25 0
0 23 0 0 45
A= 0 0 0 0 32
42 0 0 31 0
0 0 0 0 0
0 0 30 0 0
Group – 3
1. List and explain any 4 functions supported in C for dynamic memory allocation with examples.
2. Consider 2 polynomials A(X) = 2X1000 + 1 and B(X) = X4 + 10X3 + 3X2 + 1 with a diagram show how
these polynomials are stored in 1D array.
3. Write a function to evaluate a postfix expression and trace the same for the expression
A B / C – D E * + A C * where A = 6, B=3, C=1, D=2 and E=4.
4. Write a program to implement STACK Operations.
5. Explain how two dimensional arrays are represented in memory with an example.
Group – 4
1. What is a polynomial? What is the degree of the polynomial? Write a function to add two
polynomials.
2. Write a C Program to demonstrate the various stack operations, including cases for overflow
and underflow of STACKS.
3. Write the post fix form of the following expression.
a. ((6 + (3-2)*4^5+7)
b. A $ B $ C * D
4. Write a program to implement a stack using dynamic array whose initial capacity is 1 and
implement the operations push, pop and display.
5. Write a program in C for evaluation postfix expression.