Data Structures & Algorithms
Data Structures & Algorithms
AY 23
No
2. a. Define row major order and column major order. Given a matrix W [10] [10] 5 CO2 K3
with elements having a base address of 10000. If the size of each memory is
10 bytes, then find the address of W[5][5] in row major order and also in
column major order.
b. Given a stack implemented using an array, write down the algorithms for the 5 CO3 K3
operations performed on it, such as:
(i) Push (ii) pop
(OR)
c. Given an infix expression X= Q+W/E-R*T+Y-U 5 CO4 K2
Find its equivalent postfix expression using Stack.
d. Briefly elaborate the evaluation process of given postfix expression P = 2, 3, 5 CO3 K3
15, 10, 2, /, -, *, +, 4, + using Stack
3.a. Given a list of elements: 70, 40, 50, 30, 35, 25, 45. Write down the algorithm 5 CO4 K3
for applying insertion sort to the elements to sort them in ascending order.
b. Write down the algorithm for implementing binary search on a sorted list of 5 CO3 K3
elements present in an array.
(OR)
c. Write down the algorithms for implementing queue concepts on a single 5 CO4 K2
linked list and perform the operations:
(i) insertion of a node at the rear-end (ii) deletion of a node from the front-end
Page 1 of 2
d. Write down the algorithm from implementing the deletion of a node from the 5 CO3 K3
end of a double linked list.
4.a. Construct a binary tree using the traversal sequence of nodes given below: 5 CO2 K3
In-order sequence: F D B E I G J A C H
Pre-order sequence: F D I J G E B H C A
Write down the three recursive traversal algorithms to traverse all the nodes of
a binary tree.
b. Given a sequence of numbers: 40, 30, 50, 80, 90, 20, 10, 60, 70, 100 5 CO3 K3
Construct a Binary Search Tree and then write down the algorithm for
applying searching operations to it.
(OR)
c. Write down the non-recursive in-order traversal method for traversing all the 5 CO4 K2
nodes of a binary tree.
d. Briefly explain the sequential representation and linked representation of the 5 CO1 K3
given binary tree below.
d. Write down the algorithm to traverse all the nodes of a graph using a queue. 5 CO2 K3
6.a. Given a list of 6 elements: 30, 32, 45, 65, 57, 99 5 CO4 K3
Explain the three different hash functions and find the hash addresses using all
the hash functions.
b. Write down the algorithm for applying bubble sort to a list of numbers given 5 CO5 K2
input in an array.
(OR)
c. Write down the algorithm for evaluating postfix expression using stack. 5 CO4 K3
d. Write down the algorithms to perform the operations on a double linked list: 5 CO6 K2
(i) count the total no. of nodes (ii) find the sum of all the node values.
Page 2 of 2