Question Bank of Data structures
Question Bank of Data structures
SHORT QUESTIONS
1. What is data structure? Define Abstract data type.
2. Define stack and queue with examples.
3. Given one dimensional array A [100] in which each memory location of
size 16 bytes. Find the address of A [20] when the base address is 10000.
4. Define row major order and column major order
5. Suppose an array A [10] having contains elements from index 0 to 5. How
can we insert a new item at index 2 without disturbing the linear order of
elements in array?
6. Define sparse matrix with a suitable example
7. Define sparse matrix with a suitable example. The following sequence of
operations are performed on an empty stack: PUSH (1), PUSH (0), PUSH
(0), PUSH (1), POP, POP, PUSH (1), PUSH (0), POP? Write the sequence
of the popped out items.
8. Find out the PREFIX expression for the given infix: (B *C ^ D) using
mathematical process of conversion.
9. Convert the following infix expression (C * D ^ E) into postfix using
STACK
10.List out different common operations we apply on a 1D array.
11. Write the steps to count the number of nodes of a single linked list.
12.State the difference between linear search and binary search.
13.What is linked stack?
14.What are the advantages of linked list over array?
15.What is linked Queue?
16.State the difference between single linked list and circular single linked
list?
17.Write the algorithm steps for finding the middle position node in a single
linked list when we know the total no. of nodes are 11.
18.Write the procedure to count the no. of leaf nodes in a binary tree.
19.What is Balance Factor?
20.Define terms: skew binary tree, strictly binary tree
21.How to find the height of a tree? Give an example.
22.State the difference between a Tree and a cyclic Graph.
23.Construct a binary tree when the sequence of nodes given as:
In order : 10, 20, 25, 30, 35, 50, 60, 70, 90
Preorder : 50, 20, 10, 30, 25, 35, 70, 60, 90
24.A sequence of elements given below. Construct a Binary Search Tree.
70, 20, 10, 40, 60, 90, 75, 49, 65, 95
25.Given binary tree:
30.List out the traversal methods of a graph? State the operational difference
between them
31.What is the adjacency matrix of the graph given below?
32.Find the in-degree and out-degree of each vertex of the graph given below:
LONG –QUESTIONS
1. List out the standard notations of algorithm.
2. Write an algorithm to test a number is prime or not.
3. Write an algorithm to find largest and smallest element present in an array
4. Given a matrix Q [7][8] in which the size of each memory location is 4
bytes. Find the address of Q [5][2] when the base address is 5000 and the
memory is occupied in row major order.
5. Using stack demonstrate how to generate equivalent postfix expression of
the infix expression
(A + B - (C * D / E))
6. Briefly elaborate the evaluation process of given postfix expression P = 2,
3, 15, 10, 2, /, -, *, +, 4, + using stack
7. Write down the algorithm to test a matrix is sparse or not and if sparse
store the non-zero information into another 3-column matrix.
8. Write a program to input elements into a 4X4 matrix and display the sum
of individual row elements using UDF.
9. Write down the algorithm to evaluate the postfix expression using stack
also apply it on the given postfix expression: 2, 100, 2, /, 20, -, *, 10, -
10.Find the postfix expression of given infix: (Q-W*E/(R+T*Y)-U) using
stack. Also write down the algorithm for infix to postfix conversion using
stack.
11.Write a program using C to create a stack of numbers and perform using
UDF:
(i) push operation (ii) pop operation (iii) display operation
12.Design an algorithm for selection sort. Explain the process with an
example.
13.Write an algorithm for bubble sort. Explain it with suitable example.
14.Write down the algorithm for performing push and pop operations in a
linked stack.
15.Explain and design the algorithm for searching for an item and then delete
that item.
16.Write down the algorithm for performing insertion and deletion operations
in a linked queue.
17.Write down the algorithms for linear search and binary search operations
and state the difference.
18.What is a Binary Search Tree? Write the steps of algorithm for inserting
an element into a BST.
19.Briefly elaborate the memory representation of a binary tree and their
types with suitable example.
20.Write down the algorithm for Inorder traversal for a binary tree. When an
inorder and preorder sequence of nodes given then how to construct a
binary tree.
21.How to construct a binary tree when inorder and post order sequence of
node given? Also write down the algorithm for preorder traversal of a
binary tree
22.Write down all the 3 different recursive traversal methods for traversing
nodes of a binary tree.
23.Given a sequence of
elements:70,20,10,30,40,50,60,25,35,45,75,95,10,52,92
Construct an AVL tree by inserting each element
24.Given an infix expression (A+B/C-D^E*F-G)
Find its equivalent postfix notation and then using stack.
25.What is Heap Tree and its types? Explain the procedure for construction
of Max heap Tree and Min Heap Tree both with suitable example.
26.Write Warshall’s algorithm to find the path matrix of a graph.
27.What is path matrix? Write down adjacency matrix and incidence matrix
of the following graph. Also represent the linked concept for memory
representation of below graph.
28.Write the algorithm for BFS on a directed graph and write down the
explanation.
29.Write the algorithm for Depth First Search of a graph. Write down the
DFS order of the graph given below.
30.Define the path matrix? State the difference by writing down adjacency
matrix and incidence matrix of the following graph. Also represent the
linked concept for memory representation of below graph.