0% found this document useful (0 votes)
18 views13 pages

Data Structure Question Bank

The document is a question bank for the Data Structures course (19CST301) for the Computer Science and Engineering department. It covers various topics including linear data structures like lists, stacks, and queues, as well as non-linear data structures such as trees and graphs. Each unit contains multiple parts with questions that focus on definitions, algorithms, comparisons, and applications related to data structures.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views13 pages

Data Structure Question Bank

The document is a question bank for the Data Structures course (19CST301) for the Computer Science and Engineering department. It covers various topics including linear data structures like lists, stacks, and queues, as well as non-linear data structures such as trees and graphs. Each unit contains multiple parts with questions that focus on definitions, algorithms, comparisons, and applications related to data structures.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

19CST301 DATA STRUCTURES (R 2019)


QUESTION BANK
[I, II, III, IV & V Units]

(FOR III SEM CSE)

PREPARED BY
K.ASHOK KUMAR
Associate Professor/CSE
UNIT I -LINEAR DATA STRUCTURES – LIST
Abstract Data Types (ADTs) – List ADT – array-based implementation – linked list
implementation –– singly linked lists- circularly linked lists- doubly-linked lists – applications of
lists –Polynomial Manipulation – All operations (Insertion, Deletion, Merge, Traversal).

Q. Questions
No
PART =A
1 Define ADT. Give any two examples.
2 Distinguish between linear and nonlinear data structures.
3 Compare calloc() and realloc() function and mention its application in linked list.
4 Describe the differences between singly and doubly linked lists.
5 List out the areas in which data structures are applied extensively.

6 Define nonlinear data structure.


7 Compare singly linked list with circular linked list.
8 State the advantage of ADT.
9 List out the advantage of circular linked list.
10 Binary search cannot be performed on a linked list. Examine.
11 Discuss the advantages and disadvantages of linked list over array.
12 Give an example for linked list application.
13 Specify the use of Header node in a linked list.
14 Illustrate the difference between linear linked list and circular linked list.
15 Show the ways in which list ADT can be implemented.
16 Differentiate arrays and linked lists.
17 Analyze and write a find routine in array implementation.
18 Analyze and write the array representation of a polynomial: p(x) = 4x3+6x2+7x+9

19 Should arrays or linked lists be used for the following types of applications? Support
your justification.
1. Many search operations in sorted list.
2. Many search operations in Unsorted list.
20 Develop an algorithm for insertion operation in a singly linked list.
PART- B
1 Describe the following:
i. Applications of lists. (5)
ii. Polynomial manipulation. (8)
2 i. What is a linked list? (2)
ii. Describe the suitable routine segments for any four operations. (11)
3 List an algorithm to perform the following operations in a doubly linked list.

i. Insert a node at the end of the list. (6)


ii. Delete the last node in the list. (7)
4 i. Discuss the insertion and deletion procedures for cursor based linked (7)
lists.
ii. Give an algorithm for the deletion and reverse operations on doubly (6)
linked list.
5 i. Give the algorithm to perform insertion on a doubly linked list. (7)
ii. Give the algorithm to perform deletion on a doubly linked list. (6)
6 Write an algorithm to demonstrate a polynomial using a linked list for
i. Addition and Subtraction. (7)
ii. Multiplication operations. (6)
7 Analyze and write algorithm for Circular Linked list for the following
operations using structure pointer.
i. Create& Insert (6)
ii. Delete & Display. (7)
8 Explain the application of linked list in detail.
i. Radix sort. (7)
ii. Multi list. (6)
9 Consider an array A[1: n] Given a position, write an algorithm to insert an (13)
element in the Array. If the position is empty, the element is inserted
easily. If the position is already occupied the element should be inserted
with the minimum number of shifts. (Note: The elements can shift to the
left or to the right to make the minimum number of moves).
10 Develop a program to add the values of the nodes of a linked list and then (13)
calculate the mean.
11 Describe the various operations of the list ADT with examples. (13)
12 i Illustrate the polynomial representation for 6x3 + 9x2 +7x +1 (7)
using linked list. Write procedure to add and multiply two
polynomial and explain with suitable example.
ii What are the ways to insert a node in linked list? Write an algorithm (6)
for inserting a node before a given node in a linked list.
13 Explain the steps involved in the following insertion operations in a Singly linked
list.
i. Insert the node in the start and End. (7)
ii. Insert the node in the middle of the List (6)
14 Discuss an algorithm for linked list implementation of list. (13)
PART - C
1 Create an algorithm to add two polynomials using linked list. (15)
2 Explain an algorithm to split a linked list into two sub lists containing (15)
odd and even ordered elements in them respectively.
3 Explain an algorithm to merge two sorted linked lists into a single sorted (15)
list.
4 Design algorithm for various operations performed on circular linked list. (15)
Extend the algorithm defined in the previous question for the doubly linked
circular list.
UNIT II - LINEAR DATA STRUCTURES – STACKS, QUEUES

Stack ADT – operations –Applications-Evaluating arithmetic expressions- Conversion of


infix to postfix expression-Queue ADT –operations-circular queue –priority queue – deQueue-
applications of queues

Q.
No Questions
PART - A
1 Point out the advantage of representing stack using a linked list than array.
2 Point out the rules followed during the infix to postfix conversions.
3 Compare the working of stack and queue data structure.
4 Develop an algorithm for inserting a new element into the stack.
5 What are priority queues? What are the ways to implement priority queue?
6 List any four applications of stack.
7 Given the prefix for an expression. Write its postfix:
-*-+abc/ef-g/hi
8 Describe how the following "infix" expression is evaluated with the help of the help of
Stack : 5 * ( 6 + 2 ) - 12 / 4
9 Give the postfix and prefix forms of the expression: A + B*
(C – D) / (P – R)
10 Define double ended queue.
11 List the applications of a queue.
12 What are the applications of priority queue?
13 What is circular queue?
14 Circular queue is better than standard linear queue, Why?
15 Classify the different types of queues.
16 Illustrate the difference between a queues and linked lists with an example.
17 Complete a routine to display the contents of queue.
18 Analyze and write a routine to check whether the queue is full or empty.
19 For railway reservation the queue data structure is preferred –Justify.
20 Develop an algorithm for deleting an element in a double ended queue.
PART - B
1 Describe with an example how to evaluate arithmetic expressions using stacks.
2 i. Explain array based implementation of stacks.
ii. Explain linked list implementation of stacks.
3 i. Describe about stack ADT in detail.
ii. Explain any one application of stack.
4 Explain the following expressions with an example.
i. Prefix and infix.
ii. Postfix.
5 i. Write an algorithm to convert an infix expression to a postfix
expression.Trace the algorithm to convert the infix expression (a+b)*c/d+e/f
to a postfix expression.
ii. Justify the need for Infix and Postfix expression.
6 i. Give an algorithm for push and pop operations on stack using a linked list.
ii. Discuss about addition and deletion operations performed on a circular
queue with necessary algorithms.
7 i. Describe the process of postfix expression evaluation with an example.
ii. Describe the process of conversion from infix expression to postfix
expression using stack.
8 i. Write an algorithm that checks if expression is correctly parenthesized using stack and
illustrate with an example.
ii. Write the function to examine whether the stack is full() or empty()
9 i. Describe about queue ADT in detail.
ii. Explain any one application of queue with suitable example.
10 Briefly describe the operations of queue with examples.
11 Analyze and write an algorithm to implement queue functions using arrays.
12 Develop an algorithm to perform the four operations in a double ended
queue that is implemented as an array.
13 Discuss circular queue and its implementation.
14 Illustrate the enqueue and dequeue operations on double ended queues.
PART - C
1 Develop and Show the simulation using stack for evaluation of the following
expression :
12 + 3 * 14 – (5 * 16) + 7
2 Explain an algorithm to implement the circular queue using arrays. List the
applications of Queues.
3 Assess the difference between double ended queue and circular queue. Show the
simulation using stack for the following expression to convert infix to postfix: p * q =
(r-s / t).
4 Develop an algorithm to explain Priority Queue, deQueue and the applications of queues.
UNIT III -NON LINEAR DATA STRUCTURES-TREES

Tree ADT – tree traversals - Binary Tree ADT – expression trees – applications of trees –
binarysearch tree ADT –Threaded Binary Trees- AVL Trees – B-Tree - B+ Tree - Heap –
Applications of heap.

Q. Questions
No
PART - A
1 If the depth of the binary tree is k, the maximum number of nodes in the
binary tree is 2k-1.Justify
2 For the given binary search tree, if we remove the root and replace it with something
from left sub tree. What will be the value of the new root? Justify your answer.

3 Define a fully binary tree. Give an example.


4 Create an expression tree for the expression. a*(b+c)+((d+e*f)*g)
5 How does the AVL tree differ from binary search tree?
6 What are the various rotations in AVL trees?
7 List the applications of trees.
8 What are threaded binary trees? Give its advantages
9 Define balance factor of AVL Tree.
10 How do we calculate the balance factor for each node in an AVL tree?
11 Simulate the result of inserting 3,1,4,6,2,8,9 into an initially empty AVL Tree.
12 Discuss with respect to following tree:
a) List the siblings for node E.
b) Compute the height
13 Number the following binary tree to traverse it in
i. Preorder
ii. Inorder

14 Explain why binary search cannot be performed on a linked list.


15 How do you calculate the depth of a B-Tree?
16 List out the various operations that can be performed on B-trees
17 List out the properties of B+ -Trees
18 Illustrate the steps in the construction of a heap of records with the following key
values:12,33,67,8,7,80,5,23
19 Analyze the properties of binary heap.
20 Define a heap and show how it can be used to represent a priority queue.
PART - B
1 Write an algorithm for preorder, in order and post order traversal of a binary tree.
2 Explain the following operations on a binary search tree with suitable algorithms
i. Find a node
ii. Find the minimum and maximum elements of binary search tree
3 i. Write short notes on threaded binary tree
ii. Describe an iterative algorithm to traverse a tree in preorder
4. Write an algorithm for inserting and deleting a node in a binary search
tree.
5 Discuss in detail the various methods in which a binary tree can
be represented. Discuss the advantage and disadvantage of each method
6 i. Explain the B+ tree and its properties with an Example
ii. What are the steps to convert general tree to binary tree?
7 i. Construct B Tree to insert the following key elements(order of the
tree is 3) 5,2,13,3,45,72,4,6,9,22
ii. Draw a B Tree of order 6
8 i. Discuss how to insert an element in a AVL tree, Explain with algorithm.
ii. Explain how deletion can take place in AVL trees with suitable algorithms
9 i. What are AVL trees? Describe the different rotations defined for AVL tree.
ii. Insert the following elements step by step in sequence into an empty AVL tree
15,18,20,21,28,2330,26
10 i. Point out the operations of B-tree using 2-3 tree.
ii. Explain the operations of threaded binary tree.
11 Discuss the different traversal technique in binary tree with suitable algorithms and
examples?
12 Explain the construction of expression tree with example.
Give the applications of trees
13 i. Show the result of inserting 15,17,6,19,11,10,13,20,8,14,12 one at a time into an
initially empty binary min heap.
ii. Show the result of performing three delete min operations in the final binary min heap
obtained.
14 i. Illustrate How delete operation performed on binary heap?
ii. Write suitable operations for percolate up and percolate down operations in a
binary heap.
PART - C
1 Consider the binary search tree given below.
Find the result of in-order, pre-order, and post-order traversals. Show the
deletion of the root node
Insert 11, 22, 33, 44, 55, 66, and 77 in the tree

2 i. Compare B trees with B+ trees.


ii. Create a B+ tree of order 5 for the following data arriving in sequence: 90, 27, 7, 9, 18,
21, 3, 4, 16, 11, 21, 72
3 i. Draw B – Tree pf order m = 5 for the keys {K, O,S,V,MF,B,G,T,U,W}
ii. Delete the keys K and G in order.
iii. Justify the number of splits needed for inserts / delete with proper reasons.
4 Construct AVL tree for the followings after rotation.
UNIT IV -NON LINEAR DATA STRUCTURES –GRAPHS

Definition – Representation of Graph – Types of graph - Breadth-first traversal - Depth-


first traversal – Topological Sort – Bi-connectivity – Cut vertex – Euler circuits – Applications
of graphs.
Q.No Questions
PART-A
1 What is a graph and its types?
2 Consider the graph given below. Create the adjacency matrix of it

3 Find out the in-degree and out-degree of each node in the given graph
4 Create a complete undirected graph having five nodes
5 Given the following adjacency matrix, draw the weighted graph.
6 When do you say a graph is bi-connected?
7 Give the purpose of Dijikstra’s algorithm.
8 Differentiate cyclic and acyclic graph
9 Classify strongly connected and weakly connected graph.
10 How to find all articulation points in a given graph?
11 Define the length of the graph.
12 Define minimum spanning tree. Give an example
13 State the principle of Topological sorting.
14 Explain procedure for Depth first search algorithm.
15 Analyze Bi-connectivity.
16 Prove that the number of edges in a complete graph of n vertices inn(n-1)/2
In a complete graph with n vertices, show that the number of spanning trees is at
17 least 2 n-1-1
18 What are Euler circuits?
19 Give two applications of graphs.
20 What is residual graph?
PART - B
1 Describe in detail about the following representations of a graph.
i. Adjacency Matrix
ii. Adjacency List
2 i. Consider the given directed acyclic graph D. Sort the nodes D by applying
topological sort on ‘D
ii. Consider the graph given below and show its adjacency list in the memory

3 i. Explain the topological sorting of a graph G with example.


ii. Quote the step wise procedure for topological sort.
4 Differentiate depth-first search and breadth-first search traversal of a graph with
suitable examples.
5 i. Explain with algorithm, How DFS be performed on a undirected graph.
ii. Show the algorithm for finding connected components of an undirected
graph using DFS, and derive the time complexity of the algorithm.
6 i. Discuss an algorithm for Breadth first Search on a graph
ii. Give an example based on the algorithm.
7 i. Illustrate Kruskal’s algorithm to find the minimum spanning tree of a
graph.
ii. Trace the algorithm for the following graph

8 Compare any two applications of Graph and describe with your own example
9 Describe any one of the shortest path algorithms with suitable example
10 Discuss the prim’s algorithm for minimum spanning tree. Give an example.
11 i. Write a program to find an Euler circuit in a graph.
ii. Trace the algorithm for the given graph.

12 Develop an algorithm to compute the shortest path using Dijkstra’s algorithm.


Validate the algorithm with suitable example.
13 Explain the depth first approach of finding articulation points in
a connected graph with necessary algorithm.
14 i. Write short notes on Bi-connectivity.
ii. Express different types of graphs with example.
PART - C
1 Given the adjacency matrix of a graph, write a program to calculate the in-degree
and the out-degree of a node N in the graph.
2 Consider five cities: (1) New Delhi, (2) Mumbai, (3) Chennai, (4) Bangalore, and
(5) Kolkata, and a list of flights that connect these cities as shown in the following
table. Use the given information to construct a graph.

3 i. How can we efficiently check whether or not a graph is disconnected?


ii. Describe an algorithm that uses a brute force approach to find all the
articulation points in G in O(V (V + E)) time.
4 i. Given a rooted tree, one desires to find the shortest path from the root to a given
node v. Which algorithm would one use to find this shortest path?
ii. Write a program to determine whether there is at least one path from the source
to the destination.
UNIT V SORTING, SEARCHING AND HASH TECHNIQUES
Sorting algorithms: Insertion sort - Selection sort - Shell sort - Bubble sort - Quick sort - Merge sort -
Radix sort – Searching: Linear search –Binary Search Hashing: Hash Functions – Separate Chaining
– Open Addressing – Rehashing – Extendible Hashing

PART – A
Q.No Questions
1 What are the advantage and disadvantage of separate chaining and linear
probing?
2 Define extendible hashing.
3 Give the fastest searching algorithm.
4 What is meant by internal and external sorting? Give any two examples for
each type.
5 Describe the complexity of bubble sort.
6 Name the applications of linear and binary search techniques.
7 Give the time complexities of bubble sort and quick sort.
8 Predict the fastest sorting algorithm, justify.
9 Compare internal and external sorting.
10 Distinguish between linear and binary search technique.
11 Classify the different sorting methods.
12 Develop an algorithm for a quick sort.
13 Which hashing technique is best and illustrate with an example?
14 Summarize the open addressing hashing method with an example.
15 Point out the advantages of using quick sort.
16 Compare the working of linear and binary search techniques.
17 Select the best sorting method out of the following - insertion sort, quick sort
and merge sort and give justification.
18 Illustrate the time complexity of insertion sort with an example.
19 Identify the advantage of shell sort over insertion sort.
20 Develop a simple algorithm for a linear search.
PART -B
1 Describe how the divide and conquer technique is implemented in binary
search.
2 Describe the algorithm to sort the following array: 77, 33, 44, 11, 88, 22, 66,
55
i. Insertion sort
ii. Shell Sort
3 i. List the different types of hashing techniques?
ii. Explain them in detail with an Example.
4 i. Interpret the result of inserting the keys 2, 3, 5, 7, 11, 13, 15, 6, 4 into an initially
empty extendible hashing data structure with M = 3.
ii. Discuss the running time of Divide-and-Conquer Merge sort algorithm.
5 i. Sort the sequence 3, 1, 4, 1, 5, 9, 2, 6, 5 using Insertion sort.
ii. Describe the routine for insertion sort.
6 Write an algorithm to sort a set of ‘N’ numbers using quick sort.Demonstrate
the algorithm for the following set of numbers: 88,11,22,44,66,99,32,67,54,10.
7 Explain the various collision resolution techniques in detail with an example.
8 Compare the below different Sorting methods and discuss about each method in a very
detailed Manner.
i. Bucket Sort.
ii. Selection Sort .
9 i. Sort the given integers and Explain the intermediate results using shell sort:
35,12,14,9,15,45,32,95,40,5.
ii. Write and Explain a C code to sort an integer array.
10 i. Createa algorithm to perform a binary Search.
ii. Develop an algorithm for Merge sort with an example.
11 i. Write short notes on Bubble Sort.
ii. Illustrate an algorithm to sort the elements using bubble sort.
12 Describe the following collision resolution techniques in detail with an example.
i. Separate chaining.
ii. Rehashing.
13 i. Explain different hashing technique.
ii. Explain the rehashing technique with suitable example.
14 Describe the open addressing and chaining methods of collusion resolution techniques in
hashing.
PART C
1 Develop an algorithm to search a number in a given set of numbers using
binary search. Develop and algorithm to explain Extendible Hashing.
2 Given input {4371, 1323, 6173, 4199, 4344, 9679, 1989} and a hash function h(x)= x(mod
10), show the resulting
i) Open hash table
ii) Closed hash table using linear probing
iii) Closed hash table using quadratic probing
3 Explain an algorithm for Shell Sort and Merge Sort and explain with example.
4 Prepare a quick sort algorithm and explain with suitable example Give its worst case,
average case and best case time complexities.

You might also like