DSA Assignment
DSA Assignment
Kumbalagodu, Bangalore-560074
ASSIGNMENT – 1
Group – 1
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.