Question Bank ALG
Question Bank ALG
DATA SCIENCE
QUESTION BANK
QUESTION BANK
YEAR/SEMESTER : II/III
VISION
MISSION
VISION
To foster industry cooperation and impart cognitive learning in order to develop professionals
who can adapt to the shifting demands of new trends in artificial intelligence and data science.
MISSION
DM 1: To provide an Excellent infrastructure that keeps up with modern trends and technologies
for students and educators.
DM 2: To impart knowledge in cutting edge technology for Artificial Intelligence and Data
Science with industrial standards.
DM 3: To impart high-quality education embedded with moral and ethical principles.
DM 4: To encourage lifelong learning and research that benefit society as a whole.
PEO2: Product Development: Design a model using Artificial Intelligence to solve the critical
problems in real world.
PEO3: Higher Studies: To enable the students to think logically and pursue life-long learning
and collaborate with an ethical attitude in a multidisciplinary team.
SYLLABUS:
UNIT DETAILS HOURS
UNIT I INTRODUCTION
Notion of an Algorithm – Fundamentals of Algorithmic Problem Solving – Important
Problem Types –Fundamentals of the Analysis of Algorithm Efficiency – Analysis
I 8
Framework - Asymptotic Notations and their properties – Empirical analysis -
Mathematical analysis of Recursive and Nonrecursive algorithms – Visualization.
TOTAL HOURS 45
PRACTICAL EXERCISES:
1. Implement recursive and non-recursive algorithms and study the order of growth from log2n to n!.
2. Divide and Conquer - Strassen’s Matrix Multiplication
3. Decrease and Conquer - Topological Sorting
4. Transform and Conquer - Heap Sort
5. Dynamic programming - Coin change Problem, Warshall’s and Floyd‘s algorithms, Knapsack Problem
6. Greedy Technique – Dijkstra’s algorithm, Huffman Trees and codes
7. Iterative improvement - Simplex Method
8. Backtracking – N-Queen problem, Subset Sum Problem
9. Branch and Bound - Assignment problem, Traveling Salesman Problem
TEXT/REFERENCE BOOKS:
T/R BOOK TITLE/AUTHORS/PUBLICATION
1. Anany Levitin, Introduction to the Design and Analysis of Algorithms, Third Edition, Pearson
T Education, 2012.
1. Ellis Horowitz, Sartaj Sahni and Sanguthevar Rajasekaran, Computer Algorithms/ C++,
Second Edition, Universities Press, 2019.
2. Thomas H.Cormen, Charles E.Leiserson, Ronald L. Rivest and Clifford Stein,
R Introduction to Algorithms, Third Edition, PHI Learning Private Limited, 2012.
3. S. Sridhar, Design and Analysis of Algorithms, Oxford university press, 2014.
4. Alfred V. Aho, John E. Hopcroft and Jeffrey D. Ullman, Data Structures and
Algorithms, Pearson Education, Reprint 2006.
COURSE OBJECTIVES:
1 To critically analyze the efficiency of alternative algorithmic solutions for the same problem
2 To illustrate brute force and divide and conquer design techniques.
3 To explain dynamic programming and greedy techniques for solving various problems.
4 To apply iterative improvement technique to solve optimization problems
5 To examine the limitations of algorithmic power and handling it in different problems.
COURSE OUTCOMES:
SNO DESCRIPTION
1 Analyze the efficiency of recursive and non-recursive algorithms mathematically
2 Analyze the efficiency of brute force, divide and conquer, decrease and conquer, Transform
and conquer algorithmic techniques
3 Implement and analyze the problems using dynamic programming and greedy algorithmic
techniques.
4 Solve the problems using iterative improvement techniques for optimization.
5 Compute the limitations of algorithmic power and solve the problems using backtracking
and branch and bound techniques.
UNIT I INTRODUCTION
UNIT I INTRODUCTION
Notion of an Algorithm – Fundamentals of Algorithmic Problem Solving – Important Problem Types –
Fundamentals of the Analysis of Algorithm Efficiency – Analysis Framework - Asymptotic Notations and
their properties – Empirical analysis - Mathematical analysis of Recursive and Nonrecursive algorithms –
Visualization.
PART – A
Univ QP (Month/
S.No. Question and Answer CO
Year)
What is performance measurement?
1.
Performance measurement is concerned with obtaining the space and the time
requirements of a particular algorithm.
What is an Algorithm?
2.
An algorithm is a sequence of unambiguous instructions for solving a problem, i.e., for obtaining
a required output for any legitimate input in a finite amount of time.
all algorithms must satisfy the following criteria:
1) input
2) Output
3) Definiteness
4) Finiteness
5) Effectiveness.
The space complexity of an algorithm is the amount of memory it needs to run to completion.
What is time complexity?
4.
The time complexity of an algorithm is the amount of computer time it needs to run to completion.
5. What are Sequential Algorithms?
The central assumption of the RAM model is that instructions are executed one after another, one
operation at a time. Accordingly, algorithms designed to be executed on such machines are called
Sequential algorithms.
6. What are Parallel Algorithms?.
The central assumption of the RAM model does not hold for some newer computers that can execute
operations concurrently, i.e., in parallel algorithms that take advantage of this capability are called
Parallel algorithms
7. What is Exact and Approximation algorithm?
The principal decision to choose solving the problem exactly is called exact algorithm.
The principal decision to choose solving the problem approximately is called Approximation algorithm.
Nov/Dec 2005
8. What is Algorithm Design Technique?
A Pseudo code is a mixture of a natural language and programming language like constructs. A
pseudo code is usually more precise than a natural language, and its usage often yields more succinct
algorithm descriptions.
10. Define Flowchart.
A method of expressing an algorithm by a collection of connected geometric shapes containing
descriptions of the algorithm’s steps.
11. What is Efficiency of algorithm?
Efficiency of an algorithm can be precisely defined and investigated with mathematical rigor. There are
two kinds of algorithm efficiency
o Time Efficiency – Indicates how fast the algorithm runs
o Space Efficiency – Indicates how much extra memory the algorithm needs.
12. What is generality of an algorithm?
It is a desirable characteristic of an algorithm. Generality of the problem the algorithm solves is
sometimes easier to design an algorithm for a problem posed in more general terms.
13. What is algorithm’s Optimality?
Optimality is about the complexity of the problem that algorithm solves. What is the minimum
amount of effort any algorithm will need to exert to solve the problem in question is called algorithm’s
Optimality.
The Worst case-Efficiency” of an algorithm is its efficiency for the worst-case input of size n,
which is an input (or inputs) of size n for which the algorithm runs the longest among all possible inputs
of that size.
Ex: if you want to sort a list of numbers in ascending order when the numbers are given in
descending order. In this running time will be the longest.
What do you mean by Best case-Efficiency” of an algorithm?
17.
The Best case-Efficiency” of an algorithm is its efficiency for the Best-case input of size n,
which is an input(or inputs) of size n for which the algorithm runs the fastest among all possible inputs of
that size.
Ex: if you want to sort a list of numbers in ascending order when the numbers are given in
ascending order. In this running time will be the smallest.
18 Define the Average-case efficiency” of an algorithm?
The Average-case efficiency” of an algorithm is its efficiency for the input of size n, for which
the algorithm runs between the best case and the worst case among all possible inputs of that size.
Define Ω notation
25.
A function t(n) is said to be in Ω (g(n)), denoted t(n) Ω (g(n)), if t(n) is bounded below by some
positive constant multiple of g(n) for all large n, i.e., if there exist some positive constant c and some non
negative integer n0 such that
T (n) < c g (n) for n > n0
26. Prove that n3(n2)?
Clearly n3 n2 for all n 0. i.e., we can select c=1 and n0=0.
Write algorithm using iterative function to fine sum of n
27.
numbers.
Algorithm sum(a,n)
{ S : = 0.0
For i=1 to n do
S : - S + a[i];
Return S;
}
PART – B
Univ QP (Month/
S.No. Question and Answer CO
Year)
NOV/DEC 2017,
1 Describe the steps in analyzing & coding an algorithm CO1
APRIL/MAY 2018
Steps in analyzing and coding the algorithm
Example algorithm
Analysis of algorithm
Example
complexity
Explain the various asymptotic notations used in algorithm
3 CO1
design.
Big Oh
Big Theta
Big Omega
4. Explain the basic efficiency classes. CO1
Explanation
Set up & solve a recurrence relation for the number of key
6. CO1
comparisons made by above pseudo code.
Recurrences
Solve recurrence relation
. PART – C
Univ QP (Month/
S.No. Question and Answer CO
Year)
Explain about binary search with example
Introduction
Explanation
Example
Algorithm
Complexity
Explain about linear search with example.
Introduction
Explanation
Example
Algorithm
Complexity
Explain about insertion sort with example.
Introduction
Explanation
Example
Algorithm
Complexity
Explain about heap sort with example.
Introduction
Explanation
Example
Algorithm
Complexity
6. Finished.
22 Define biconnected graph?
A graph is called biconnected if there is no single node whose removal causes the graph to break into two
or more pieces. A node whose removal causes the graph to become disconnected is called a cut vertex.
What are the two traversal strategies used in traversing a
23
graph?
a. Breadth first search
b. Depth first search
24 Define articulation point.
Articulation Points (or Cut Vertices) in a Graph A vertex in an undirected connected graph is an
articulation point (or cut vertex) if removing it (and edges through it) disconnects the graph. Articulation
points represent vulnerabilities in a connected network – single points whose failure would split the
network into 2 or more disconnected components. They are useful for designing reliable networks.
PART – B
Univ QP (Month/
S.No. Question and Answer CO
Year)
Explain the various representation of graph with example in
1
detail?
Adjacency Matrix
Adjecency List
2 Define topological sort? Explain with an example?
Introduction
Explanation
Example
Algorithm
Complexity
3 Explain Dijkstra's algorithm with an example?
Introduction
Explanation
Example
Algorithm
Complexity
Complexity
2 Explain the depth first search algorithm
Introduction
Explanation
Example
Algorithm
Complexity
Write and explain the prim’s algorithm and depth first search
3
algorithm.
Introduction
Explanation
Example
Algorithm
Complexity
Given a function to compute on ‘n’ inputs the divide-and-comquer strategy suggests splitting the inputs in
to’k’ distinct susbsets, 1<k <n, yielding ‘k’ subproblems.
The subproblems must be solved, and then a method must be found to combine subsolutions into a
solution of the whole. If the subproblems are still relatively large, then the divide-and conquer strategy
can possibly be reapplied.
A control abstraction we mean a procedure whose flow of control is clear but whose primary operations
are by other procedures whose precise meanings are left undefined.
In conclusion we are now able completely describe the computing time of binary
search by giving formulas that describe the best, average and worst cases.
Successful searches
q(1) q(logn) q(Logn)
best average worst
unsuccessful searches
q(logn)
Algorithm BinSearch(a,n,x)
//Given an array a[1:n] of elements in nondecreasing
// order, n>0, determine whether x is present
{
low : = 1;
high : = n;
while (low < high) do
{
mid : = [(low+high)/2];
if(x < a[mid]) then high:= mid-1;
else if (x >a[mid]) then low:=mid + 1;
else return mid;
}
return 0;
}
12. Define external path length?
The external path length E, is defines analogously as sum of the distance of all
external nodes from the root.
Insertion sort works exceedingly fast on arrays of less then 16 elements, though for
large ‘n’ its computing time is O(n2).
The problem is to find the maximum and minimum items in a set of ‘n’ elements. Though
this problem may look so simple as to be contrived, it allows us to demonstrate divideand-comquer in
simple setting.
PART – B
Univ QP (Month/
S.No. Question and Answer CO
Year)
1 Write Shote notes on
Divide and conquer Strategy
Dynammic Programming
Adjacency Matrix
Adjecency List
2 Explain with an example Huffman Trees.algorithm
Introduction
Explanation
Example
Algorithm
Complexity
3 Explain Optimal Merge pattern
Introduction
Explanation
Example
Algorithm
Complexity
Explain Greedy Technique for activity-selection
4
problem
Introduction
Explanation
Example
Algorithm
Complexity
Explain Optimal Binary Search Trees with dynamic
5
programming
Introduction
Explanation
Example
Algorithm
Complexity
6 Explain Multi stage graph with dynamic programming.
Introduction
Explanation
Example
Algorithm
Complexity
7 Explain dynamic programming with Matrix-chain multiplication.
Introduction
Explanation
Example
Algorithm
Complexity
PART – C
Univ QP (Month/
S.No. Question and Answer CO
Year)
Explain the algorithm to finding maximum and minimum using
1
divide and conquer algorithm.
Introduction
Explanation
Example
Algorithm
Complexity
2 Explain Merge sort using divide and conquer method
Introduction
Explanation
Example
Algorithm
Complexity
Write and explain the Quick sort using divide and conquer
3
algorithm.
Introduction
Explanation
Example
Algorithm
Complexity