MAHENDRA ENGINEERING COLLEGE FOR WOMEN
KUMARAMANGALAM
DEPARTMENT OF INFORMATION TECHNOLOGY
CD3291 DATA STRUCTURES AND ALGORITHM
QUESTION BANK
UNIT – I
ABSTRACT DATA TYPES
Abstract Data Types (ADTs) – ADTs and classes – introduction to OOP – classes in
Python – inheritance – namespaces – shallow and deep copying Introduction to
analysis of algorithms – asymptotic notations – divide & conquer – recursion –
analyzing recursive algorithms
PART A (2 MARK)
1. Define ADT? What does it focus on? (Nov/Dec 2022,2019,2015,2013,2012)
2. Give the general recurrence for divide and conquer algorithms. (Nov/Dec 2022)
3. What is analysis of recursive algorithms? Specify it's types.(Apr/may 2021)
4. Define access specifier and it's types with an example.
5. Define linear and non-linear data structure. Give example for each.(nov/dec
2013)
6. Discuss about python built-in classes.
7. Define constructor and it's types with an example.
8. State destructor with an python program.
9. What is operator overloading? Explain with example.
10.Illustrate the use of namespace and name resolution.
11.Differentiate iteration and recursion.
12.Define method overriding and method overloading.
PART B (13 MARK)
1. What is the purpose of asymptotic notation. Explain it. (nov/dec 2022),
(apr/may 2022).
2. Discuss about features and characteristics of OOP with suitable example.
(nov/dec 2022)
3. Discuss about inheritance and it's types with an example.
4. Describe about divide and conquer algorithm with an example and python
program.
5. Consider the following recursive algorithm for computing sum of first n
cubes.s(n)= 13+23+33...+n3
Algorithm s(n)
//Input A positive integer n
// Output sum of the first n cubes.
If n=1 return 1
Else return s(n-1)+n*n*n
Identify basic operation in algorithm.Setup the recurrence relation for
number of times algorithm basic operation is executed and solve it using
back substitution.(Nov/Dec 2022)
6. Ellaborate shallow and deep copy with an example.
PART C (15 MARK)
1. Discuss about recursion with an example and write suitable python program.
2. Explain in detail about towers of Hanoi with an example and write suitable
implementation.
UNIT – II
LINEAR STRUCTURE
List ADT – array-based implementations – linked list implementations – singly linked
lists – circularly linked lists – doubly linked lists – Stack ADT – Queue ADT – double
ended queues – applications
PART A (2 MARK)
1. Define circular linked list.What is it's disadvantage?(Nov/Dec 2022)
2. Define list ADT.
3. What are the ways of implementing linked list?
4. How to convert singly linked list to circular list and it's benefits? (Apr/May
2021)
5. Write down the disadvantage of linked list over array. (Apr/May
2019,2017),(Nov/Dec 2018),(May/June 2013).
6. State sentinel and it's advantage.
7. Differentiate stack and queue ADT.(APR/MAY 2022)
8. Name the best method of implementing stack (Array/Pointer/cursor). Give
justification.( APR/MAY 2021)
9. Convert infix to postfix expression (A-B/C)*(D/E-F).(NOV/DEC 2022)
10.Define Overflow and Underflow.
11.State D.Q or DECK. Illustrate its unique features.
12.What conversion is required for queue data structure to behave as a circular
queue.(NOV/DEC 2021)
PART B (13 MARK)
1. What are the advantage of linked list over array? Give the structure of singly
linked list and specify it's disadvantage.How to overcome it. write an
algorithm to reverse a singly linked list. (nov/dec 2022)
2. Explain in detail about doubly linked list with all it's operation and give an
example and python program.(may/June 2016)
3. Write procedure or pseudocode for following operations on circular linked
lists.
a)insertion
b)deletion
c)count (nov/dec 2021)
4. Define Stack. Write an algorithm to convert an infix expression to postfix
expression and apply the same to convert ((A+B)-C*(D/E))+F to postfix
expression. (NOV/DEC 2022)
5. What is DEQUE? Explain types and its operations with diagrammatic
representations. (APR/MAY 2022)
6. Discuss about Queue data structure. Explain about applications of Queue.
(NOV/DEC 2021)
PART C (15 MARK)
1. Implement polynomial addition using linked list.Have procedure for
insertion, comparison, addition of node values of it's polynomial
applications.(Nov/Dec 2021)
2. Define Postfix expression. Write an algorithm for evaluating postfix
expression using stack and evaluate 6 5 2 3 + 8 * + 3 + *.
(MAY/JUNE 2011, NOV/DEC 2009).
UNIT – III
SORTING AND SEARCHING
Bubble sort – selection sort – insertion sort – merge sort – quick sort – analysis of
sorting algorithms – linear search – binary search – hashing – hash functions –
collision handling – load factors, rehashing, and efficiency
PART A (2 MARK)
1. How do you differentiate external and internal sorting.(APR/MAY 2021,
NOV/DEC 2022)
2. What is insertion sort? How many passes are required for the elements to be
sorted.( NOV/DEC 2022)
3. Compare sorting algorithms efficiency.(APR/MAY 2021, MAY/JUNE
2010)
4. Compare linear and binary search.(NOV/DEC 2019,APR/MAY 2015)
5. Define divide and conquer method with sorting example.
6. Explain about pivot element and its selection.
7. What is the need for hashing?(NOV/DEC 2022)
8. Define hash function. Give example.(NOV/DEC 2022, NOV/DEC 2021 )
9. What is the reason for collision in hashing technique?( NOV/DEC 2021)
10.Define Re-hashing. (NOV/DEC 2015,2013,2011,2009)
11.What is meant by open addressing? (MAY/JUNE 2012,NOV/DEC 2012)
12.Difference between static and dynamic hashing.( MAY/JUNE 2013)
PART B (13 MARK)
1. Explain various collision resolution strategies followed in hashing
technique.(APR/MAY 2022, NOV/DEC 2021)
2. When do you perform rehashing? Illustrate with an example.(APR/MAY
2019).
3. Create extendible hash structure with python hash table implementation to
insert the following key elements.
2,3,5,7,11,17,19,23,29,31. Show the extendible hash structure for this file if
hash function is f(x)=x mod 8 and bucket can hold 3 records.(MAY/JUNE
2013)
4. Write a program to sort elements using bubble, insertion and selection sort.
(NOV/DEC 2022)
5. Write an algorithm to perform quick sort and analyze the best case
complexity to it. Apply it to sort 24,50,17,35,10,90,82,31.(NOV/DEC 2022)
6. Write a program to perform searching operations using linear and binary
search.(NOV/DEC 2022)
PART C (15 MARK)
1. Consider a hash table with 9 slots. The hash function is h(k)=k mod 9.The
following keys are inserted in the order 5,28,19,15,20,33,12,17,10.Draw the
contents of the hash table when the collision are resolved by 1. chaining 2.
linear probing 3.quadratic probing 4. double hashing.The second hash
function is h2(x)=7-(xmod7). (APR/MAY 2019)
2 Given input (4371,1323,6173,4199,4344,9679,1989) and hash function
h(x)=x mod 10. Show the resulting.
1) open addressing hash table with linear probing.
2) open addressing hash table with quadratic probing.
3) open addressing hash table with second hash table with second hash
function h2(x)=7-(x mod 7)
UNIT – IV
TREE STRUCTURES
Tree ADT – Binary Tree ADT – tree traversals – binary search trees – AVL trees –
heaps – multiway search trees
PART-A (2 MARK)
1. What is the main property of binary tree.(apr/may 2022)
2. Define full(complete) binary tree. Is the tree given below a full binary tree.
3. Define BST.(nov/dec 2019)
4. What do you mean by level of the tree?(nov/dec 2019)
5. Define tree.
6. Define sibling and terminal node or leaf.
7. Define tree traversal and its types.
8. What is expression tree.
9. Define binary heap and Construct a max heap for the following data
20,1,2,40,30.(nov/dec 2022)
10.What is multiway search tree and its 2 properties of (2,4) tree?
11.What is balance factor?
12.Discuss about priority queue.
PART B (13 MARK)
1. How are NULL pointers in a binary tree removed? Write the pseudocode for
binary tree traversals.Traverse the binary tree given below using
inorder,preorder and postorder traversals and remove null pointers from it.
(nov/dec 2022)
2. What is heap? How to build max-heap and min-heap?(apr/may2022)
3. Explain in detail the steps involved in converting general tree into binary
tree. (nov/dec 2022)
4. Give the prefix and postfix form of the expression (a+(b*c-e))/f). (nov/dec
2022)
5. Construct expression tree for the expression (a+b*c)+(d*e+l)*g).Give the
outputs when you apply preorder,inorder and postorder traversal. (nov/dec
2022)
6. List the properties of m-way search tree.construct a 3 way search tree using
the keys: 7,17,1,4,3,2,10,15,19,21.From the constructed tree delete
19,1,1,7.Assume deletions are independent of one another.(apr/may 2021)
PART C (15 MARK)
1. Construct a binary search tree by inserting 3,1,4,9,6,5,2,8,7 into an initially
empty tree. show the results of deleting nodes 1,6,7 one after the other of the
constructed tree.(nov/dec 2021)
2. Construct an AVL tree by inserting 4,1,2,5,6,17,3,7 into an initially empty
tree, Show the results of deleting nodes 1,6,7 one after the other of the
constructed tree.(nov/dec 2021)
UNIT V
GRAPH STRUCTURES
Graph ADT – representations of graph – graph traversals – DAG – topological
ordering – greedy algorithms – dynamic programming – shortest paths – minimum
spanning trees – introduction to complexity classes and intractability
PART-A
1. Find the topological ordering of the following graph.(nov/dec 2022)
2. Define complexity class P and NP.(nov/dec 2022)
3. Define shortest path problem with an example.(nov/dec 2022,apr/may 2021)
4. What do you mean by DAG.Give example.(apr/may 2022)
5. Differentiate weakly connected graph and strongly connected
graph.(nov/dec 2021)
6. Define greedy algorithm with an example.
7. Define bi-connectivity and articulation point.(nov/dec 2021)
8. Differentiate BFS and DFS.
9. What is optimization and decision problem.
10.Define dynamic programming with components and example.
11.Define Intractability and 2 types of problems in Intractability.
12. What are the various ways of representing graph.(apr/may 2022)
PART – B
1. Define graph.List out various graph traversal algorithm with an example and
its applications (nov/dec 2022)
2. Explain about unweighted shortest path with an example.(nov/dec 2021)
3. Discuss about Prim-jarnik algorithm with an example.
4. Explain about topological ordering with an example.
5. Explain in detail about different representations of graph with an example.
(nov/dec 2022)
6. Discuss about the complexity classes in detail.
PART – C
1. Define minimum spanning tree. Explain kruskal algorithm to find MST of
the graph.Apply the algorithm to find MST of given graph. (nov/dec 2022)
2. List the properties of greedy approach. Explain Dijkstra’s algorithm to find
the shortest path from a source vertex and analyse the time complexity of the
approach.Apply the same on the graph given below to find the shortest path
from vertex ‘a’.(nov/dec 2022)