0% found this document useful (0 votes)
100 views1 page

Assignment-3 1 November 2020: P (X) Anxn + An 1xn 1 + - . - + A1x + A0 (, Design A Linear Algorithm For This

This document contains 4 questions about algorithms and their time complexities. Q1 asks to design brute force and linear time algorithms for computing polynomial values and discusses if a better than linear time algorithm exists. Q2 asks to design brute force and efficient algorithms for counting substrings between A and B. Q3 asks for the time complexity of a brute force algorithm for the 3D closest pair problem. Q4 asks about the travelling salesman problem and to solve it using brute force.

Uploaded by

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

Assignment-3 1 November 2020: P (X) Anxn + An 1xn 1 + - . - + A1x + A0 (, Design A Linear Algorithm For This

This document contains 4 questions about algorithms and their time complexities. Q1 asks to design brute force and linear time algorithms for computing polynomial values and discusses if a better than linear time algorithm exists. Q2 asks to design brute force and efficient algorithms for counting substrings between A and B. Q3 asks for the time complexity of a brute force algorithm for the 3D closest pair problem. Q4 asks about the travelling salesman problem and to solve it using brute force.

Uploaded by

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

Assignment-3

1st November 2020


Q1: Design a brute-force algorithm for computing the value of a polynomial
p(x) = anxn + an−1xn−1 + . . . + a1x + a0
at a given point x0 and determine its worst-case efficiency class.
b. If the algorithm you designed is in Θ(n2 ¿, design a linear algorithm for this
problem.
c. Is it possible to design an algorithm with a better-than-linear efficiency for this
problem?

Q2: Consider the problem of counting, in a given text, the number of substrings
that start with an A and end with a B. For example, there are four such substrings
in CABAAXBYA.
a. Design a brute-force algorithm for this problem and determine its
efficiency class.
b. Design a more efficient algorithm for this problem.

Q3: The closest-pair problem can be posed in the 3-dimensional space, in which
the Euclidean distance between two point’s p1(x1, y1, z1) and p2(x2, y2, z2) is
defined as
D = √ (x 1−x 2)2 +( y 1− y 2)2+(z 1−z 2)2

What is the time-efficiency class of the brute-force algorithm for the 3-dimensional
closest-pair problem?

Q4: What is travelling sales problem? Solve it using brute force.

You might also like