DS IMP Questions Module Wise
DS IMP Questions Module Wise
13. Write a C code to display the triplet form for the sparse matrix.
14. Write a C code to display the transpose of sparse matrix.
Prerana Educational and Social Trust®
PES Institute of Technology and Management
NH-206,Sagar Road,Shivamogga-577204
Module 2 Questions
1. Define stack. Explain the different operations that can be performed on stack
using c-functions.
2. Write an algorithm to convert infix expression to postfix expression.
3. Write a program to convert infix to postfix expression using stack Data
structure.
4. Write the postfix form of the following infix expression using stack.
i) A$B*C-D+E/F/(G+H)
ii) A-B/(C*D$E)
6. Write a program to evaluate the postfix expression using stack Data
structure.
7. Write an algorithm to evaluate postfix expression. Apply the same for the
given postfix expression ABC-D*+E$F+ and assume
A=6,B=3,C=2,D=5,E=1 AND F=7.
8. Write an algorithm to convert infix to prefix expression. Apply the same to
convert the following infix expression to prefix expression.
a. (A+B*C)*((D+E-F)/J)
8. Write a program to convert infix to prefix expression using stack.
9. Define recursion. Write a program to find out the factorial of a number using
recursion.
10.Write a program to solve Tower of Hanoi problem for ‘n’ number of discs
using recursion.
11.Write a program to find the GCD and LCM of 2 numbers using recursion.
12.Write C functions for CQInsert() and CQDelete operations on circular
queue.
13.Define queue. List different types of queues. State the limitation of ordinary
queue. Explain how do you overcome the limitation by specifying the
required C- statements and diagrammatic representation using an example.
14.Write a note on Dqueue( Double Ended) and priority queue
15. Write a program to implement linear queue operations.
Prerana Educational and Social Trust®
PES Institute of Technology and Management
NH-206,Sagar Road,Shivamogga-577204
Module 3 Questions
1. Define Linked list. Write C functions for the following operations on SLL.
a) Insertion at the beginning b) Insertion at the end
c) Deletion at the beginning d)Deletion at the end
2. Explain concept of sparse matrix representation using linked list. Represent
the following sparse matrix in linked list format.
00304
A= 00570
00000
02600
Module 4 Questions
1. Define binary tree with an example. Write recursive routine (Function) to
traverse the given tree using inorder, preorder and postorder.
2. Define binary search tree. Draw the BST for the following. Also show the
array and linked list representation of the same.
14 15 4 9 7 18 3 5 16 20 17 9
100 85 45 55 110 20 70 65
3. Given the following traversal draw the binary tree
i)
a) Inorder: 4 2 5 1 6 7 3 8
b) Postorder: 4 5 2 6 7 8 3 1
ii)
a) Preorder: A B C E I F J D G H K L
b) Inorder: E I C F J B G D K H L A
4. Represent the below tree using
a) Linked list representation.
b) Array representation
A
B C D
E F
G H
J K
5. Write a function to insert the element in a binary search tree.
6. Define threaded binary tree. List its advantages and disadvantages. Draw
one way threading and 2 way threading of the following binary tree.
A
B C
D E F G
H
Prerana Educational and Social Trust®
PES Institute of Technology and Management
NH-206,Sagar Road,Shivamogga-577204
B C
D A
G F
8. Explain how do you construct and add a node to binary tree using C
statements.
9. Define expression tree. Construct an expression tree for: a + b *c / f ^ g – h.
10.Write diagrammatic explanation, explain how do you create and construct a
BST. Also write C functions for the same.
11. Explain the tree terminologies
a) Binary tree
b) Binary search tree
c) Level of a node
d) Complete binary tree
e) Degree of a tree
f) Expression tree
g) Threaded binary tree
h) Ancestor
i) Descendant
j) Degree of a node
k) Full/ strict Binary tree
Prerana Educational and Social Trust®
PES Institute of Technology and Management
NH-206,Sagar Road,Shivamogga-577204
Module 5 Questions
2. Define traversal method. List and explain the different graph traversal
methods. Find the resultants of the types of graph traversal methods ( bfs
and dfs) on the following graph. ( consider ‘a’ as starting vertex)
b d
a f
c e
3. For the graphs below given show the adjacency matrix and adjacency list
representation.
b
e1
A C
e3
e2
a c e e5
e4
5 A
B F e7
e6
d f
Prerana Educational and Social Trust®
PES Institute of Technology and Management
NH-206,Sagar Road,Shivamogga-577204