0% found this document useful (0 votes)
37 views9 pages

Design and Analysis of Algorithms - AD3351 - Important Questions With Answer - Unit 2 - Brute Force and Divide and Conquer

Uploaded by

fearlesssparrows
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views9 pages

Design and Analysis of Algorithms - AD3351 - Important Questions With Answer - Unit 2 - Brute Force and Divide and Conquer

Uploaded by

fearlesssparrows
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Click on Subject/Paper under Semester to enter.

Professional English Discrete Mathematics Environmental Sciences


Professional English - - II - HS3252 - MA3354 and Sustainability -
I - HS3152 GE3451
Digital Principles and
Statistics and Probability and
Computer Organization
Matrices and Calculus Numerical Methods - Statistics - MA3391
- CS3351
- MA3151 MA3251
3rd Semester
1st Semester

4th Semester
2nd Semester

Database Design and Operating Systems -


Engineering Physics - Engineering Graphics
Management - AD3391 AL3452
PH3151 - GE3251

Physics for Design and Analysis of Machine Learning -


Engineering Chemistry Information Science Algorithms - AD3351 AL3451
- CY3151 - PH3256
Data Exploration and Fundamentals of Data
Basic Electrical and
Visualization - AD3301 Science and Analytics
Problem Solving and Electronics Engineering -
BE3251 - AD3491
Python Programming -
GE3151 Artificial Intelligence
Data Structures Computer Networks
- AL3391
Design - AD3251 - CS3591

Deep Learning -
AD3501

Embedded Systems
Data and Information Human Values and
and IoT - CS3691
5th Semester

Security - CW3551 Ethics - GE3791


6th Semester

7th Semester

8th Semester

Open Elective-1
Distributed Computing Open Elective 2
- CS3551 Project Work /
Elective-3
Open Elective 3 Intership
Big Data Analytics - Elective-4
CCS334 Open Elective 4
Elective-5
Elective 1 Management Elective
Elective-6
Elective 2
All Computer Engg Subjects - [ B.E., M.E., ] (Click on Subjects to enter)
Programming in C Computer Networks Operating Systems
Programming and Data Programming and Data Problem Solving and Python
Structures I Structure II Programming
Database Management Systems Computer Architecture Analog and Digital
Communication
Design and Analysis of Microprocessors and Object Oriented Analysis
Algorithms Microcontrollers and Design
Software Engineering Discrete Mathematics Internet Programming
Theory of Computation Computer Graphics Distributed Systems
Mobile Computing Compiler Design Digital Signal Processing
Artificial Intelligence Software Testing Grid and Cloud Computing
Data Ware Housing and Data Cryptography and Resource Management
Mining Network Security Techniques
Service Oriented Architecture Embedded and Real Time Multi - Core Architectures
Systems and Programming
Probability and Queueing Theory Physics for Information Transforms and Partial
Science Differential Equations
Technical English Engineering Physics Engineering Chemistry
Engineering Graphics Total Quality Professional Ethics in
Management Engineering
Basic Electrical and Electronics Problem Solving and Environmental Science and
and Measurement Engineering Python Programming Engineering
www.BrainKart.com
4931_Grace College of Engineering

DEPARTMENT OF ARTIFICIAL INTELLIGENCE AND DATA

SCIENCE

B.Tech-Artificial Intelligence and Data Science

Anna University Regulation: 2021

AD3351-DESIGN AND ANALYSIS OF ALGORITHMS

II Year/ III Semester

Unit-II : BRUTE FORCE AND DIVIDE AND CONQUER

QUESTION BANK

Prepared By,

Mrs.P.Joy Suganthy Bai, AP/CSE


AD3351_DAA

https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
www.BrainKart.com
4931_Grace College of Engineering, Thoothukudi

UNIT II BRUTE FORCE AND DIVIDE AND CONQUER

QUESTION BANK

PART - A

1. State the Convex Hull Problem. [Nov/Dec 2019]


The convex hull of a set of points is defined as the smallest convex polygon, that encloses all
of the points in the set. Convex means that the polygon has no corner that is bent inwards.

2. Write the Brute force algorithm to string matching.[Apr/May 2019]


Algorithm NAÏVE(Text, Pattern)
n=length[Text]
n=length[Pattern]
for s=1 to n-m
if pattern[1…m]==Text[s+1…s+m]
Print ”location of pattern is found with shift s”
Time Complexity= O(m)

3. What is the time and space complexity of Merge Sort? [Apr/May 2019]

Time Complexity Space Complexity


Best Case: (n log n) Best Case: (n log n)
Average Case: (n log n) Average Case: n log n
Worst Case: (n log n) Worst Case: n log n

4. What is exhaustive search?[Apr/May 2018]


An Exhaustive Search, also known as generate and test, is a very general problem solving
technique that consist of systematically enumeration all possible candidates for the solution
and checking whether each candidate satisfies the problem’s statement.

5. State Master’s Theorem. [Apr/May 2018]


hat
Let T(n) be a monotonically increasing function tsatisfies
T (n) = aT (n/b)
+ f (n) T (1) = c
Where a 1,b 2,c  0. If f(n) Θ(nd ) where d  0, then

6. What is Closest Pair Problem? [May/June 2016, Apr/May 2017]


The closest-pair problem finds the two closest points in a set of n points. It is the simplest
of a variety of problems in computational geometry that deals with proximity of points in
the plane or higher- dimensional spaces. The distance between two Cartesian coordinates is
calculated by Euclidean distance formula

7. Give the General Plan for Divide and Conquer Algorithms[Nov/Dec 2017]

AD3351_DAA

https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
www.BrainKart.com
4931_Grace College of Engineering, Thoothukudi

A divide and conquer algorithm works by recursively breaking down a problem into
two or more sub-problems of the same (or related) type (divide), until these become simple
enough to be solved directly (conquer).
Divide-and-conquer algorithms work according to the following general plan:
 A problem is divided into several subproblems of the same type, ideally of about equalsize.
 The subproblems are solved (typically recursively, though sometimes a different
algorithm is employed, especially when subproblems become smallenough).
 If necessary, the solutions to the subproblems are combined to get a solution to
theoriginal problem.
Example: Merge sort, Quick sort, Binary search, Multiplication of Large Integers and Strassen’s
Matrix Multiplication.

8. Write the advantages of insertion sort. [ Nov/Dec 2017]


 Simple implementations
 Efficient for Small Data Sets
 Stable
 More efficient
 Online

9. Derive the Complexity of Binary Search [Apr/May 2015]


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 Unsuccessful searches


Best case - (1) Best case, Average case, Worst case -
Average case - (log2 n) (log2 n)
Worst case - (log2 n)

10. Write about traveling salespersonproblem.


Let g = (V, E) be a directed. The tour of G is a directed simple cycle that includes every vertex in
V. The cost of a tour is the sum of the cost of the edges on the tour. The traveling salesperson
problem to find a tour of minimum cost.

11. What is binarysearch?


Binary search is a remarkably efficient algorithm for searching in a sorted array. It
works by comparing a search key K with the arrays middle element A[m]. if they match
the algorithm stops; otherwise the same operation is repeated recursively for the first half
of the array if K < A[m] and the second half if K > A[m].
K >A[0].....A[m-1]A[m]A[m+1] A[n-1]
search here if KA[m]

12. What is Knapsack problem? [Nov/Dec 2019, Nov/Dec2014]


A bag or sack is given capacity and n objects are given. Each object has weight wi and
profit pi. Fraction of object is considered as xi (i.e) 0<=xi<=1 .If fraction is 1 then entire
object is put into sack. When we place this fraction into the sack, we get wi xi and pi xi.
13. What is convexhull?
Convex Hull is defined as: If S is a set of points then the Convex Hull of S is the smallest
convex set containing

AD3351_DAA

https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
www.BrainKart.com
4931_Grace College of Engineering, Thoothukudi

14. Write the algorithm for Iterative binarysearch.


AlgorithmBinSearch(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;
}

15. Define internal path length and external pathlength.


The internal path length ‘I’ is the sum of the distances of all internal nodes from the root.
The external path length E, is defines analogously as sum of the distance of all external nodes
from the root.

16. Write an algorithm for brute force closest-pair problem. [Nov/Dec2016]


Algorithm BruteForceClosestPair(P )
//Finds distance between two closest points in the plane by brute force
//Input: A list P of n (n ≥ 2) points p1(x1, y1), . . . ,pn(xn, yn)
//Output: The distance between the closest pair of points
d←∞
for i←1 to n − 1 do
for j ←i+ 1 to ndo
d ←min(d, sqrt((xi − xj )2 + (yi− yj )2)) //sqrt is square root
return d

17. Design a brute-force algorithm for computing the value of apolynomial


P(x) =anxn+an-1 xn-1 + …+ a1x…a0 at a given point x0 and determine its worst case efficiency
class. 1

Algorithm BetterBruteForcePolynomialEvaluation(P[0..n], x)
//The algorithm computes the value of polynomial P at a given point x by the “lowest-to-
highest
//term” algorithm
//Input: Array P[0..n] of the coefficients of a polynomial of degree n, from the lowest to the
//highest, and a number x
//Output: The value of the polynomial at
the point x p ← P[0]; power ← 1
for i ← 1 to ndo
power ← power ∗ x
p ← p + P[i] ∗ power
return p

AD3351_DAA

https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
www.BrainKart.com
4931_Grace College of Engineering, Thoothukudi

18. Show the recurrence relation of divide-and-conquer?


The recurrence relation is
T(n) = g(n)
T(n1) +T(n2)+ + T(nBTL) + f(n)

19. What is the Quick sort and Write the Analysis for the Quick sort?
In quick sort, the division into sub arrays is made so that the sorted sub arrays do not need to
be merged later. In analyzing QUICKSORT, we can only make the number of element
comparisons c(n). It is easy to see that the frequency count of other operations is of the same
order as C(n).

20. List out the Advantages in Quick Sort


It is in-place since it uses only a small auxiliary stack
 It requires only n log(n) time to sort n items
 It has an extremely short inner loop
This algorithm has been subjected to a thorough mathematical analysis, a very precise
statement can be made about performanceissues

21. What is Divide and Conquer Algorithm?[MAY/JUNE 2016][NOV/DEC 2017]


It is a general algorithm design techniques that solved a problem’s instance by dividing it into
several smaller instance, solving each of them recursively, and then combining their solutions
to the original instance of the problem.

PART B & C

1. Explain Divide and Conquer Method


2. Explain Merge Sort with suitable example.

3. Discuss Quick Sort Algorithm and Explain it with example. Derive Worst case and Average
Case Complexity. [Apr/May 2019]

4. Explain in detail about Travelling Salesman Problem using exhaustive search. [Nov/Dec
2019]
5. Explain in detail about Knapsack Problem. [Apr/May 2019]
6. Write algorithm to find closest pair of points using divide and conquer and explain it with
example. Derive the worst case and average case time complexity. [Nov/Dec 2019]

7. What is Convex hull problem? Explain the brute force approach to solve convex-hull with an
example. Derive time complexity. [Apr/May 2019]

AD3351_DAA

https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
Click on Subject/Paper under Semester to enter.
Professional English Discrete Mathematics Environmental Sciences
Professional English - - II - HS3252 - MA3354 and Sustainability -
I - HS3152 GE3451
Digital Principles and
Statistics and Probability and
Computer Organization
Matrices and Calculus Numerical Methods - Statistics - MA3391
- CS3351
- MA3151 MA3251
3rd Semester
1st Semester

4th Semester
2nd Semester

Database Design and Operating Systems -


Engineering Physics - Engineering Graphics
Management - AD3391 AL3452
PH3151 - GE3251

Physics for Design and Analysis of Machine Learning -


Engineering Chemistry Information Science Algorithms - AD3351 AL3451
- CY3151 - PH3256
Data Exploration and Fundamentals of Data
Basic Electrical and
Visualization - AD3301 Science and Analytics
Problem Solving and Electronics Engineering -
BE3251 - AD3491
Python Programming -
GE3151 Artificial Intelligence
Data Structures Computer Networks
- AL3391
Design - AD3251 - CS3591

Deep Learning -
AD3501

Embedded Systems
Data and Information Human Values and
and IoT - CS3691
5th Semester

Security - CW3551 Ethics - GE3791


6th Semester

7th Semester

8th Semester

Open Elective-1
Distributed Computing Open Elective 2
- CS3551 Project Work /
Elective-3
Open Elective 3 Intership
Big Data Analytics - Elective-4
CCS334 Open Elective 4
Elective-5
Elective 1 Management Elective
Elective-6
Elective 2
All Computer Engg Subjects - [ B.E., M.E., ] (Click on Subjects to enter)
Programming in C Computer Networks Operating Systems
Programming and Data Programming and Data Problem Solving and Python
Structures I Structure II Programming
Database Management Systems Computer Architecture Analog and Digital
Communication
Design and Analysis of Microprocessors and Object Oriented Analysis
Algorithms Microcontrollers and Design
Software Engineering Discrete Mathematics Internet Programming
Theory of Computation Computer Graphics Distributed Systems
Mobile Computing Compiler Design Digital Signal Processing
Artificial Intelligence Software Testing Grid and Cloud Computing
Data Ware Housing and Data Cryptography and Resource Management
Mining Network Security Techniques
Service Oriented Architecture Embedded and Real Time Multi - Core Architectures
Systems and Programming
Probability and Queueing Theory Physics for Information Transforms and Partial
Science Differential Equations
Technical English Engineering Physics Engineering Chemistry
Engineering Graphics Total Quality Professional Ethics in
Management Engineering
Basic Electrical and Electronics Problem Solving and Environmental Science and
and Measurement Engineering Python Programming Engineering

You might also like