Need help with your Discussion

Get a timely done, PLAGIARISM-FREE paper
from our highly-qualified writers!

glass
pen
clip
papers
heaphones

Boston University Algorithms Worksheet

Boston University Algorithms Worksheet

Boston University Algorithms Worksheet

Description

Problem 1:Let n be a positive integer. Partition the following set of 15 functions into equivalence classes

such that f(n) and g(n) are in the same equivalence class if and only if f(n) = ?(g(n)). (If a base of a

logarithm is not specified, it is assumed to be equal 2.)

9 log 3

? n

n n 8e 2 +

1

e n

4 log 8 + 2 n log(4 n )

nlog(n!) 4 (

n

2 )

n 2 4 n + n 5 (0.5) n

n! n n + n! 2 2n n 2 logn log 5 (n

1

3 )

Then arrange the equivalence classes into a sequence

C 1 ,C 2 ,C 3 ···

such that for any f(n) ? C i and g(n) ? C i+1 f(n) = O(g(n)).

Problem 2: An elevator brought you to the ground floor of a building. You want to exit the building.

You don’t know, where the exit from the building is. There are 5 different paths that you can take. The

problem is that all five paths are infinitely long, and only one of them has a door that you can use to exit

the building. The distance between the elevator and the door is no less than 30 steps. (Make sure to use

this information!) You don’t know, which of the four paths has the door, but you will see it once you are in

front of it. Design an algorithm that enables you to find the door by walking at most O(n) steps, where n

is the number of steps that you would have taken if you knew where the door is and walked directly to it.

What is the constant multiple in the big-O bound for your algorithm?

Problem 3: Use the method of iterative substitution to solve the following recurrence. Give the asymptotic

solution as well. Assume that T(n) is constant for n ? 5.

1

Homework 1: CS 141

(Asymptotic notations)

Intermediate Data Structures and Algorithms

T(n) =

(

c if n ? 5

T(n ? 4) + log(n) if n > 5

Problem 4:

(a) Use the method of iterative substitution to solve the following recurrence.

T(n) =

(

2 if n ? 7

T(n 1/3 ) + ?(loglogn) if n > 7

(b) Use mathematical induction to prove that your asymptotic solution for (a) is correct.

Problem 5: Euclid’s algorithm uses the following simple formula, which leads to the algorithm below.

Euclid’s rule If x and y are positive integers with x ? y, then gcd(x,y) = gcd(x mod y,y).

procedure Euclid(a, b)

input: a,b are integers with a ? b ? 0

output: gcd(a,b)

if b = 0 : return a

return Euclid(b,a mod b)

Here, we will look at an alternative algorithm based on divide and conquer.

(a) Show that the following rule is true.

gcd(a,b) =

?

?

?

?

?

2gcd(a/2,b/2) if a,b are even

gcd(a,b/2) if a is odd, b is even

gcd((a ? b)/2,b) if a,b are odd

(b) Give an efficient divide-and-conquer algorithm for greatest common divisor. (You can write it in plain

English or use pseuodocode.) Argue the correctness and running time of your algorithm.

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Order Solution Now

Our Service Charter


1. Professional & Expert Writers: Eminence Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Eminence Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Eminence Papers are known for the timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Eminence Papers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.

We Can Write It for You! Enjoy 20% OFF on This Order. Use Code SAVE20

Stuck with your Assignment?

Enjoy 20% OFF Today
Use code SAVE20