DSA Question Bank
DSA Question Bank
Q. Define Sparse matrix. For the given sparse matrix, give the linked list representation:
Q. Traverse a following graph using Depth First Search (DFS) and BFS. Write DFS and
BFS sequence if starting vertex is f.
Q. Construct a binary tree from the Post-order and In-order sequence given below
In-order: GDHBAEICF
Post-order: GHDBIEFCA
Q. Define selection tree. Construct min winner tree for the runs of a game given below.
Each run consists of values of players. Find the first 5 winners.
Q. Define Binary Search tree. Construct a binary search tree (BST) for the following
elements: 100, 85, 45, 55, 120, 20, 70, 90, 115, 65, 130, 145. Traverse using in-order,
pre-order, and post-order traversal techniques. Write recursive C functions for the same.
Q. Write a recursive function to search a key value in a Binary Search Tree. Construct a
BST for the given set of values.
14, 15, 4, 9, 7, 18, 3, 5, 16, 20, 17, 9 and perform traverse on it.
Q. Discuss the advantages of threaded binary tree over binary tree and explain threaded
binary tree construction with suitable examples.
Q. Construct the Binary Search Tree using given inorder and preorder sequence:
Inorder: A, D, E, F, G, H, J, M, P, Q, R, T
Preorder: J, D, A, G, E, F, H, R, M, P, Q, T
Q. Create an expression tree for a given expression a+b*c-d/e*f and write C routines to
traverse the tree using in-order, preorder and postorder.
Q. Write a C function to search an element in a Binary Search Tree (BST). Write a C
function to find minimum element in a Binary Search Tree.
Q Give the adjacency matrix, incidence matrix and linked list representation of the
following undirected graph.