DS _Assignment1
DS _Assignment1
1.Define data structures. With a neat diagram, explain the classification of data structures with
examples. Also list & explain data structure operations.
5. What do you mean by pattern matching? Outline the Knuth Morris Pratt (KMP) algorithm and
illustrate it to find the occurrences of the following pattern.
P: ABCDABD
S: ABCABCDABABCDABCDABDE
6. What is Sparse Matrix? Write ADT of Sparse Matrix. Express the given Sparse Matrix as triplets
and find its transpose.
7.Define stack. Implement push, pop and display operations for stack using arrays.
.
8. Write a C function to convert infix to a postfix expression. Convert the given expression:
A $ B * C – D + E / F / (G + H)
10. Give the disadvantage of ordinary queue and how it is solved in circular queue. Explain with
suitable example how you would implement insert, delete and display circular queue using array.
11. Write a program in C to implement a stack of integers using a singly linked list
12. What is a linked list? Explain the different types of linked list with diagram
13.
14 With the C function to explain how the elements are inserted and deleted
from a doubly linked list
15. Define Recursion. Explain types of recursion. Write recursive function for
(i) Factorial (ii) Tower of Hanoi
16. Write the C function to add two polynomials. Show the linked representation of the below two
polynomials and their addition using a circular singly linked list
P1: 5x3 + 4x2 +7x + 3
P2: 6x2 + 5
Output: add the above two polynomials and represent them using the linked list.
17. Write an algorithm to evaluate a postfix expression. Trace the algorithm for the following expression showin
stack contents 651-4*23^/+
19. What are the differences between array and linked lists.
20. Write functions in C for the following operations without using built-in functions
i Compare two strings.
ii Concatenate two strings.
iii Reverse a string