Professional Documents
Culture Documents
DEPARTMENT OF ECE
DATA STRUCTURES AND ALGORITHMS
Question bank
Unit-1
1. Which type of Linked List does not store null in the next field?
PART B
1.List out the application of Linked list.
2. Summarize any two issues in array-based implementation of list ADT.
3.State the difference between arrays and linked lists.
4. List the basic operations carried out in a linked list.
10. List out the advantages and disadvantages of using a linked list
PART C
1. Write routines to delete a node at middle and end of a list implemented with doubly
linked list. (7)
2. Explain the operation of deletion (beginning and end) in array-based list with
procedure and suitable examples. (7)
3. Write routines to insert a node at middle and end of a list implemented with doubly
linked list. (7)
4. Explain the operation of insertion (beginning and end) in array-based list with
procedure and suitable examples. (7)
5. Write a routine for Creation ,insertion, deletion using doubly linked list.(14)
Note:
✓ Study all the routines of Insertion, deletion using singly and doubly
linked list
✓ Creation- singly linked list)
UNIT 2
MCQ
1. In a stack, if a user tries to remove an element from an empty stack it is called
_________
a) Underflow
b) Empty collection
c) Overflow
d) Garbage Collection
2. The circular queue will be full only when
a) FRONT = MAX-1 and REAR = MAX-1
b) FRONT = 0 and REAR = MAX-1
c) FRONT = MAX-1 and REAR = 0
d) FRONT = 0 and REAR = 0
3. What is the term for inserting into a full queue known as?
a) null pointer exception
b) underflow
c) overflow
d) program won’t be compiled
4. The postfix form of the expression (A+ B)*(C*D- E)*F / G is
a) AB+ CD*E - FG /**
b) AB + CD* E - F **G /
c) AB + CD* E - *F *G /
d) AB + CDE * - * F *G /
5.Queue follows?
a) FIFO b) LIFO c)FILO d)LILO
6. Stack follows?
a) FIFO b) LIFO c)FILO d)LILO
7. 3) If stack is full, top=?
a) size b) size-1 c) 1 d)0
8.If stack is empty, top=?
a) 0 b) 1 c) -1 d) none
9. Stack can be implemented using _________ and ________?
a) Array and Binary Tree b) Linked List and Graph
c) Array and Linked List d) Queue and Linked List
10. Insertion and Deletion operation in Queue is known as ?
4. Write an routine for enqueue and dequeue operations using a linked list with example.
7.What are the limits of Linear Queue?How to overcome using circular Queue?Explain the
operations of enqueue and dequeue in circular queue.
8. Write an routine for push and pop operations using stack with example.
UNIT 3
MCQ
1. Total number of nodes at the nth level of a binary tree can be given as
a)2h
b)2(h+1)-1
c)2h
d) 2(h-1)-1
2. For the expression (2-(6*8))+(1/4) which of the following is the post order tree
traversal?
a) 268*-14/+
b) 14/+268*-
c) *268-14/+
d) 26*+814/-
3. In which traversal, first the parent is visited, then the left child and finally the right
child?
a) Inorder traversal
b) Level order traversal
c) Postorder traversal
d) Preorder traversal
4. Why we need to a binary tree which is height balanced?
a) to avoid formation of skew trees
b) to save memory
c) to attain faster memory access
d) to simplify storing
5. Which is not a type of binary tree
a) skewed b) complete c) perfect d) level
6. Interior node is means node at least with _____ child
a) 0 b) 1 c) 2 d) 3
7. Parent is also called as
a) descendants b) ansister c) node d) branch
8. To represent hierarchical relationship between elements, which data structure
is suitable?
a) Dequeue b) Priority c) Tree d) Graph
9. In a binary search tree, which of the following traversals would print the numbers in the
ascending order?
a) Level-order traversal
b) Pre-order traversal
c) Post-order traversal
d) In-order traversal
10.What is the worst case time complexity of inserting n2 elements into an AVL-tree with n
elements initially?
a) O(n) b) O(n2) c)O(n2 log n) d)O(n3)
11.AVL tree is a self-balancing Binary Search Tree (BST) where the difference between
heights of left and right sub trees cannot be more than one for all nodes.
12. What is a complete binary tree?
a) Each node has exactly zero or two children
b) A binary tree, which is completely filled, with the possible exception of the bottom level,
which is filled from right to left
c) A binary tree, which is completely filled, with the possible exception of the bottom level,
which is filled from left to right
d) A tree In which all nodes have degree 2
13. Which of the following is incorrect with respect to binary trees?
a) Let T be a binary tree. For every k ≥ 0, there are no more than 2k nodes in level k
b) Let T be a binary tree with λ levels. Then T has no more than 2 λ – 1 nodes
c) Let T be a binary tree with N nodes. Then the number of levels is at least ceil(log (N +
1))
d) Let T be a binary tree with N nodes. Then the number of levels is at least floor(log (N
+ 1))
14. What is the average case time complexity for finding the height of the binary tree?
a) h = O(loglogn)
b) h = O(nlogn)
c) h = O(n)
d) h = O(log n)
15. If the size of the stack is 10 and we try to add the 11th element in the stack then the condition
is known as___
a. Garbage collection
b. Overflow
c. underflow
d. None of the above
Part B
1. The inorder and preorder traversal of a binary tree are d b e a f c g and a b d e
cf g respectively. Show the post order traversal of the binary tree.
2. What do you mean by articulation point?
3. Represent the expression A + B * (C-D) / E as a binary tree.
4. Differentiate between binary search tree and AVL tree.
5. What are the types of AVL Rotation?
6. The number of rotations required to insert a sequence of elements 9,6,5,8,7,10 into an
AVL tree is? Ans:3 rotation (need to proof)
7. State the properties of a binary tree and AVL tree.
8. What are the different binary tree traversal techniques?
9. Define AVL Tree. Give Example.
10. When AVL tree property is violated and how to solve it?
11. Define Rotation in AVL tree. Mention the two types of rotations.
12. What are the tasks performed during post-order traversal?
13. Depth of a complete binary tree is 8, compute the number of nodes in leaf.
14. Define height of the binary tree
Part C
1. Explain the different types of AVL rotations with an example. (14)
2. Construct an AVL Tree by inserting the following elements in the given order
63,9,19,27,18,108,99,81 (14)
3. What is the impact of Balanced factor?Construct an AVL Tree by inserting the following
elements in the given order 2,1,4,5,9,3,6,7 (14)
4. i)Explain the various cases to delete a node in a binary search tree with routines and
8.Write the following routines to implement the basic binary search tree operations.
(i) Perform Search operations in BST
(ii) Find _ min and Find_ max
Note:
Be thorough AVL and BST
UNIT 4
MCQ
1. An adjacency matrix representation of a graph cannot contain information of
a) Nodes
b) Edges
c) Direction of edges
d) Parallel edges
2. What is the number of edges present in a complete graph having n vertices?
a) (n*(n+1))/2
b) (n*(n-1))/2
c) N
d) Information given is insufficient
3. What is the maximum number of edges present in a simple directed graph with 7
vertices if there exists no cycles in the graph?
a) 21
b) 7
c) 6
d) 49
4. Consider a complete graph G with 4 vertices. The graph G has ____ spanning trees.
a) 15
b) 8
c) 16
d) 13
5. Every vertex should have a connection with every other
a) complete graph b) connected graph c) directed graph d) undirected graph
6. Dijkstra’s Algorithm is used to solve _____________ problems.
a) All pair shortest path
b) Single source shortest path
c) Network flow
d) Sorting
7. Which of the following ways can be used to represent a graph?
a) Adjacency List and Adjacency Matrix
b) Incidence Matrix
c) Adjacency List, Adjacency Matrix as well as Incidence Matrix
d) No way to represent
8. Prim’s algorithm is a ______
a) Divide and conquer algorithm
b) Greedy algorithm
c) Dynamic Programming
d) Approximation algorithm
9. Topological sort can be applied to which of the following graphs?
a) Undirected Cyclic Graphs
b) Directed Cyclic Graphs
c) Undirected Acyclic Graphs
d) Directed Acyclic Graphs
10. Topological sort is equivalent to which of the traversals in trees?
a) Pre-order traversal
b) Post-order traversal
c) In-order traversal
d) Level-order traversal
11. Which of the following data structure is required to convert arithmetic expression in infix
to its equivalent postfix notation?
a) Queue
b) Linked list
c) Binary search tree
d) None of above
12. Find the total number of spanning trees with 4 vertices that can be created from a
complete graph
a)13
b)14
c)15
d)16
13. What is the maximum number of edges present in a simple directed graph with 7
vertices if there exists no cycles in the graph?
a) 21
b) 7
c) 6
d) 49
14. The number of elements in the adjacency matrix of a graph having 7 vertices
is_________
a)7 b) 21 c)36 d)49
PART B
PART C
1. Consider the graph given below. Find the minimum spanning tree of the graph using Prims
Algorithm (14)
5
1 2
3
1 2 2 5
6
3 4 4
UNIT V
MCQ
1.The complexity of a linear search algorithm _________
a)O(n)
b)O(logn)
c)O(n2)
d)O(nlogn)
2. Two main measures of the efficiency of an algorithm are
a) Processor and Memory
b) Complexity and capacity
c) Time and Space
d) Date and Space
3. Consider a complete graph G with 4 vertices. The graph G has ____ spanning trees.
a) 15
b) 8
c) 16
d) 13
4. The travelling salesman problem can be solved using _________
a) A spanning tree
b) A minimum spanning tree
c) Bellman – Ford algorithm
d) DFS traversal
5.Which of the following is not a big-O notation?
a)O(n)
b)Ω(n)
c)Theta(n)
d)f(n)
6.The time complexity of a bottom up approach in Fibonacci series_________
a)O(n)
b)O(logn)
c)O(n2)
d)O(nlogn)
7. Recurrence relation is involved in_________
a)greedy method
b)divide and conquer
c)branch and bound
d)randomized algorithms
PART B
1. What is randomized algorithm?
.
2. State the principle of branch and bound algorithms.
PART C
1. .i) Discuss the NP complete problem with an example (7)
ii) Solve the following recurrence relation using substitution method
T(n)=T(n-1)+1 (7)
2. How is Branch and Bound technique used in the designing of algorithms and
explain with knapsack problem. (14)
3. Explain Divide and Conquer technique(Merge sort) in the designing of algorithms with
a clear procedure and suitable example
4. Explain the backtracking problem using 5-queen Problem.(14)
5. Demonstrate the different kinds of algorithm for designing to solve the
problem.(14)
6. How is Branch and Bound technique used in the designing of algorithms and explain
with Travelling Salesman problem.
7. Using Floyd Warshall’s algorithm finds the shortest path between all pair of node for the
following graph.