DSA Prelim Paper

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Dr. D. Y.

Patil Institute of Technology, Pimpri, Pune-411018


Department of Information Technology
Prelim Examination
Semester & Year – Sem I & 2023-2024 Class: SE
Date: 03 /12 /23 Subject : Data Structures and Algorithms
Time: 01.00-03.30 pm Maximum Marks: 70
Instruction:

1. Solve questions Q.1 or Q.2, Q.3 or Q.4, Q.5 or Q.6, Q.7 or Q.8
2. Neat diagrams must be drawn wherever necessary
3. Assume suitable data, if necessary.

Q.1 a) What is recursion, Explain the use of stack in recursion with example [9]

b) Convert the following expressions to postfix form & evaluate [9]


i) A+(B*C- ( D/E^F)*G*H
ii) (A+B^D)/(E-F)+G
For Evaluation ( A=2,B=3,C=1,D=4,E=2,F=3,G=2,H=3)
OR
Q.2 a) Write Pseudo C++ code to implement circular queue. Give applications of Queue. [9]
b) What is implicit and explicit stack? Write stack implementation using linked memory [9]
organization.
Q.3 a) Construct binary search tree for the following input. 12,8,25,14,09,06,18 and traverse [9]
the tree in inorder, Preorder and postorder
b) i) Write non recursive Pseudo C++ algorithm to traverse Binary tree in Preorder and [9]
inorder.
OR
Q.4 a) i)Construct binary tree step by step from the given traversals [5]
Preorder : J C B A D E F I G H Inorder : A B C E D F G J I H
ii) Write algorithm to trave binary tree levelwise
[4]
b) i)What is thread in a binary Tree? Explain the need of threading [4]
ii) Write C++ function to traverse inorder threaded binary tree in inorder [5]
Q.5 a) Find shortest path using Dijkstra’s Algorithm [8]

b) Find Minimum spanning tree using Prim’s and Kruskal’s algorithm , write cost of [9]
spanning tree
OR
Q.6 a) Construct step by step an AVL tree for the values 25,12,17,30, 15,14,37,27,40,29,28. [8]

b) Construct heap for the list : 23 , 7, 92, 6, 12, 14, 40, 44, 20, 21 and sort it in ascending [9]
order. Show all steps graphically by drawing the tree at each step.

Q.7 a What is file ? Explain different types of file organizations [8]

Write C++ code for following operation on sequential file


b [9]
i) Search ii) Delete
OR
Q.8 a Create a hash table for the following input , handle the collision using linear probing [8]
with and without replacement. Table size = 10 , hash function key%10
b i)What is hashing ? write properties of good hash function. [3]
ii)Explain different hash functions. [6]

You might also like