Module 1 2 QB
Module 1 2 QB
Module 1
1. Define Data Structures. Explain the types of structures with examples for each. What
are the primitive operations that can be performed?
2. Differentiate between Structures and Unions with examples.
3. What do you mean by Pattern Matching? Outline Knuth, Morris, Pratt pattern matching
algorithm. Implement KMP algorithm to find the occurrence of the following pattern P
in the main string S.
(1) S: B A C B A B A B A B A C A C A
P: A B A B A C A
(2) S: A B C X A B C D A B X A B C D A B C Y
P: A B C D A B C Y
4. Define Stack. Give the implementation of push(), pop() and Display() functions by
considering its empty and full conditions.
5. Write an algorithm to convert Infix Expression to Postfix Expression and apply the
same for the given postfix expression
(a). 6,2,/,3,-,4,2,*,+
(b). ((H * ((((A + ((B + C) * D)) * F) * G) *E)) +J)
6. Write the postfix form of the following expression using stack.
(a) A*(B*C+D*E)+F
(b) (a+(b*c)/(d-e))
(c) (a+b)*d+e/(f+a*d)+c
(d) ((a/(b-c+d))*(e-a)*c)
7. Explain the following dynamic memory allocation functions along with syntax and
example:
(a)Malloc (b) Calloc (c) realloc (d) free
8. Define polynomial. Explain with example how A(x)=3x23+3x4+4x2+15 and
B(x)=x5+20x3+2, are stored in a 1-D array.
9. Define sparse matrix. Express the following matrix in triplet form and find its transpose.
Module 2