You are on page 1of 3

Viva Voce Questions EEC/IQAC/Academic/Form1.1.

11-R00
questions EXCEL ENGINEERING COLLEGE
(Autonomous)
Approved by AICTE, New Delhi & Affiliated to Anna University, Chennai
Accredited by NBA (AERO,CSE,ECE,MECH), NAAC with “A+” and Recognised by UGC (2f &12B)
KOMARAPALAYAM – 637303
Viva voce questions and Answers connected to this course
Department MCA Academic Year : 2023-2024
Year/Semester/Class I I A Year/Semester/Class I
Faculty In charge Dr.U.SRIDEVI Subject Code 21PMC107
Subject Name Advance Data Structures and Algorithms Laboratory

Is your Subject asked in GATE /Competitive (UPSC/Govt ,etc) Examinations (Yes /No) :
Is your Subject concepts directly asked in any Interview (Yes /No) :
GATE/ UPSC Topics :

S.No Objective question with Answers


1 What is pre-order, in-order, and post-order tree traversal ?
Answer: Pre-order traversal visits the root node before its children, in-order traversal visits the
left subtree, then the root, then the right subtree, and post-order traversal visits the children
before the root..
2 Compare the recursive and iterative approaches for calculating Fibonacci numbers
Answer: The recursive approach is easy to understand but inefficient for large n due to
exponential time complexity. The iterative approach, using a loop, is more efficient with linear
time complexity and is preferred for practical applications.
3 List the difference between recursive and iterative tree traversal.
Answer: Recursive tree traversal uses function calls and a call stack, while iterative traversal
uses data structures like stacks or queues to mimic the function call stack without recursion.
4 Write how you can further optimize the iterative Fibonacci function for performance
Answer: You can optimize it by using a constant amount of memory to store only the last two
Fibonacci numbers, avoiding the need to store all previous values. This is known as the "two-
variable" or "constant-space" Fibonacci algorithm.
5 How does the Merge Sort algorithm work?
Answer: Merge Sort is a divide-and-conquer sorting algorithm. It divides the input array into
two halves, recursively sorts each half, and then merges them back together in a sorted manner.
6 How does the Quick Sort algorithm work?
Answer: Quick Sort is also a divide-and-conquer sorting algorithm. It selects a pivot element,
partitions the array into two subarrays - one with elements less than the pivot and one with
elements greater than the pivot, and then recursively sorts these subarrays.
7 What is a Binary Search Tree (BST)?
Answer: A Binary Search Tree is a data structure in which each node has at most two child
nodes, referred to as the left child and the right child. In a BST, all nodes in the left subtree of a
node have values less than the node's value, and all nodes in the right subtree have values greater
Viva Voce Questions EEC/IQAC/Academic/Form1.1.11-R00
questions EXCEL ENGINEERING COLLEGE
(Autonomous)
Approved by AICTE, New Delhi & Affiliated to Anna University, Chennai
Accredited by NBA (AERO,CSE,ECE,MECH), NAAC with “A+” and Recognised by UGC (2f &12B)
KOMARAPALAYAM – 637303
than the node's value.
8 What is the difference between a BST and a binary tree?
Answer: The key difference is the ordering property in a BST. In a BST, the left subtree of a
node contains only values less than the node's value, and the right subtree contains values
greater than the node's value. In a binary tree, there is no specific ordering rule, and it may
not necessarily be sorted.
9 What is a Red-Black Tree?
Answer: A Red-Black Tree is a type of self-balancing binary search tree. It is designed to
maintain balance by assigning one of two colors (red or black) to each node and ensuring that
certain properties are maintained to guarantee balanced height.
10 What are the key properties of a Red-Black Tree?
Answer: Red-Black Trees must satisfy the following properties:
- Each node is colored either red or black.
- The root is always black.
- Red nodes cannot have red children (no consecutive red nodes).
- Every path from the root to a null leaf (i.e., a leaf with no data) must have the same
number of black nodes, ensuring balanced height.
11 What is a Heap?
Answer: A Heap is a specialized binary tree-based data structure where the parent node's
value is either greater (in a max heap) or smaller (in a min heap) than its children's values. It
ensures that the highest (in max heap) or lowest (in min heap) value is always at the root.
12 How can you represent a Heap in memory?
Answer: A Heap can be represented as an array. In this representation, each element in the
array corresponds to a node in the Heap. The parent-child relationships can be determined
using index calculations.
13 What is a Fibonacci Heap?
Answer: A Fibonacci Heap is a type of heap data structure used for priority queue operations.
It consists of a collection of trees and satisfies the "lazy" or "lazy meld" property, which
allows it to have improved amortized time bounds for certain operations compared to standard
binary heaps.
14 What is the key feature that differentiates a Fibonacci Heap from a binary heap?
Answer: The key feature that differentiates a Fibonacci Heap is its ability to have multiple
children for a single node, making it a forest of trees instead of a strict binary tree structure.
15 What is Depth-First Search (DFS) in a graph?
Answer: DFS is a graph traversal algorithm that explores as far as possible along a branch
before backtracking. It starts at a source node, visits adjacent nodes, and recursively explores
deeper into the graph until no unvisited nodes remain.
16 How can BFS be implemented using a queue?
Answer: BFS can be implemented using a queue data structure. You start with the source
node, enqueue it, and then repeatedly dequeue nodes, visit their unvisited neighbors, and
enqueue them until the queue is empty.
17 What is a Spanning Tree in a graph?
Answer: A Spanning Tree of a graph is a subset of its edges that forms a tree and spans
(includes) all the vertices in the original graph. It preserves the connectivity of the graph while
having the minimum possible number of edges.
18 How can you find a Spanning Tree in an undirected graph?

Answer: There are various algorithms to find a Spanning Tree in an undirected graph,
including:
Viva Voce Questions EEC/IQAC/Academic/Form1.1.11-R00
questions EXCEL ENGINEERING COLLEGE
(Autonomous)
Approved by AICTE, New Delhi & Affiliated to Anna University, Chennai
Accredited by NBA (AERO,CSE,ECE,MECH), NAAC with “A+” and Recognised by UGC (2f &12B)
KOMARAPALAYAM – 637303
- Depth-First Search (DFS)

- Breadth-First Search (BFS)

- Kruskal's Algorithm

- Prim's Algorithm
19 What is the Bellman-Ford Algorithm used for?
Answer: The Bellman-Ford Algorithm is used to find the shortest path from a single source node
to all other nodes in a weighted graph, even if the graph contains edges with negative weights.
20 How does the Bellman-Ford Algorithm handle negative weight edges and cycles?
Answer: The Bellman-Ford Algorithm can detect and report the presence of negative weight
cycles in the graph. It iteratively relaxes edges, and if a shorter path is found after a certain
number of iterations (equal to the number of vertices minus one), it indicates the presence of a
negative weight cycle.
21 What is the Matrix Chain Multiplication problem?
Answer: The Matrix Chain Multiplication problem involves finding the most efficient way to
multiply a sequence of matrices to minimize the total number of scalar multiplications required.
22 Why is Matrix Chain Multiplication important?
Answer: Matrix multiplication is a fundamental operation in many scientific and engineering
applications, and finding the optimal order of multiplication reduces the computational cost
significantly.
23 What is the Activity Selection problem?
Answer: The Activity Selection problem involves selecting a maximum number of non-
overlapping activities from a set of activities, each having a start and finish time, so that no
two selected activities overlap in time.
24 What is Huffman Coding used for?
Answer: Huffman Coding is used for lossless data compression. It assigns variable-length
codes to input characters based on their frequencies, with shorter codes assigned to more
frequent characters.
25 How does the Huffman Coding algorithm work?
Answer: The Huffman Coding algorithm builds a binary tree, called the Huffman Tree, by
repeatedly merging two nodes with the lowest frequencies until all characters are included in
the tree. The binary codes are generated by traversing the tree, with left branches
representing '0' and right branches representing '1'.

Faculty in Charge Verified by HOD


Higher studies/Placement coordinator

You might also like