Consider the problem of computing (xy)for given integers x and y: we want the whole answer.We know two algorithms for doing this: the iterative algorithm which performs (y - 1) multiplications by x; and the recursive algorithm based on the binary expansion of y.Compare the time requirements of these two algorithms, assuming that the time to multiply an n-bit number by an m-bit number is O(mn).

Answers

Answer 1

The recursion tree is log2m and has log2m nodes .

A recursive algorithm calls itself with smaller input values and returns the result for the current input by carrying out basic operations on the returned value for the smaller input.

A iterative method is a mathematical procedure that uses an initial value to generate a sequence of improving approximate solutions for a class of problems, in which the n-th approximation is derived from the previous ones.

In the analysis of algorithms, the master theorem for divide-and-conquer recurrences provides an asymptotic analysis for recurrence relations of types that occur in the analysis of many divide and conquer algorithms.

Two integers x and y are given. x and y require n bit and m bit respectively. Two algorithms to compute x y need to be analyzed.

Iterative: The pseudocode for this algorithm is as follows.

product = x;

for i = 2 to y do

product = product * x

The result after the multiplication of two integers, one p bits long and another one q bits long requires p q bits to to store. Therefore, for a given i , we are multiplying one ( i − 1)n bits long integer with an n bit long integer. This multiplication cost is ( i − 1)n2 .

The resulting number after the multiplication is i.n bits long. Thus

adding up all the multiplication cost we get

n2 + 2n2 + 3n2 + . . . + (y − 1)n2. Thus the complexity of the iterative algorithm is O(n2y2) which exponential in

the input length of y which is m = log2 y.

Recursive: The pseudocode for this algorithm is as follows:

function recursive (x ,y)

if y is even then return (x(by2c))2

if y is odd then return x ∗ (x(by2)c)2.

Computing (x(by2c))2

requires a multiplication involving two y2

n bits integers. The cost of this operation is y24.n2 which is O(y2n2). The recurrence relation for this

recursive routine is

T(y) = O(n) when y is 1-bit long.

T(y) = T(y2) + O(y2n2) otherwise.

Applying the Master Theorem we can conclude that T(y) ∈ O(y2n2). The height

of the recursion tree is log2m and has log2m nodes.

Thus both the algorithms have the same worst case complexity.

To know more about integers visit:

brainly.com/question/15276410

#SPJ4

Answer 2

Two integers x and y are given. x and y require n bit and m bit respectively. Two algorithms to compute x y need to be analyzed.

product = x;

for i = 2 to y do

product = product * x

The result after the multiplication of two integers, one p bits long and another one q bits long requires p q bits to to store. Therefore, for a given i , we are multiplying one ( i − 1)n bits long integer with an n bit long integer. This multiplication cost is ( i − 1)n2 .

n2 + 2n2 + 3n2 + . . . + (y − 1)n2. Thus the complexity of the iterative algorithm is O(n2y2) which exponential in

the input length of y which is m = log2 y.

function recursive (x ,y)

if y is even then return (x(by2c))2

if y is odd then return x ∗ (x(by2)c)2.

Computing (x(by2c))2

requires a multiplication involving two y2

n bits integers. The cost of this operation is y24.n2 which is O(y2n2). The recurrence relation for this

recursive routine is

T(y) = O(n) when y is 1-bit long.

T(y) = T(y2) + O(y2n2) otherwise.

Thus both the algorithms have the same worst case complexity.


Related Questions

Let A = {a, b, c}, B = {b, c, d}, and C = {b, c, e}. (a) Find A ∪ (B ∩ C), (A ∪ B) ∩ C, and (A ∪ B) ∩ (A ∪ C). (Enter your answer in set-roster notation.) A ∪ (B ∩ C) = (A ∪ B) ∩ C = (A ∪ B) ∩ (A ∪ C) = Which of these sets are equal? A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) (A ∪ B) ∩ C = (A ∪ B) ∩ (A ∪ C) A ∪ (B ∩ C) = (A ∪ B) ∩ C (b) Find A ∩ (B ∪ C), (A ∩ B) ∪ C, and (A ∩ B) ∪ (A ∩ C). (Enter your answer in set-roster notation.) A ∩ (B ∪ C) = (A ∩ B) ∪ C = (A ∩ B) ∪ (A ∩ C) = Which of these sets are equal? A ∩ (B ∪ C) = (A ∩ B) ∪ C (A ∩ B) ∪ C = (A ∩ B) ∪ (A ∩ C) A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) (c) Find (A − B) − C and A − (B − C). (Enter your answer in set-roster notation.) (A − B) − C = A − (B − C) = Are these sets equal? Yes No

Answers

Answer:

(a)

[tex]A\ u\ (B\ n\ C) = \{a,b,c\}[/tex]

[tex](A\ u\ B)\ n\ C = \{b,c\}[/tex]

[tex](A\ u\ B)\ n\ (A\ u\ C) = \{b,c\}[/tex]

[tex](A\ u\ B)\ n\ C = (A\ u\ B)\ n\ (A\ u\ C)[/tex]

(b)

[tex]A\ n\ (B\ u\ C) = \{b,c\}[/tex]

[tex](A\ n\ B)\ u\ C = \{b,c,e\}[/tex]

[tex](A\ n\ B)\ u\ (A\ n\ C) = \{b,c\}[/tex]

[tex]A\ n\ (B\ u\ C) = (A\ n\ B)\ u\ (A\ n\ C)[/tex]

(c)

[tex](A - B) - C = \{a\}[/tex]

[tex]A - (B - C) = \{a,b,c\}[/tex]

They are not equal

Step-by-step explanation:

Given

[tex]A= \{a,b,c\}[/tex]

[tex]B =\{b,c,d\}[/tex]

[tex]C = \{b,c,e\}[/tex]

Solving (a):

[tex]A\ u\ (B\ n\ C)[/tex]

[tex](A\ u\ B)\ n\ C[/tex]

[tex](A\ u\ B)\ n\ (A\ u\ C)[/tex]

[tex]A\ u\ (B\ n\ C)[/tex]

B n C means common elements between B and C;

So:

[tex]B\ n\ C = \{b,c,d\}\ n\ \{b,c,e\}[/tex]

[tex]B\ n\ C = \{b,c\}[/tex]

So:

[tex]A\ u\ (B\ n\ C) = \{a,b,c\}\ u\ \{b,c\}[/tex]

u means union (without repetition)

So:

[tex]A\ u\ (B\ n\ C) = \{a,b,c\}[/tex]

Using the illustrations of u and n, we have:

[tex](A\ u\ B)\ n\ C[/tex]

[tex](A\ u\ B)\ n\ C = (\{a,b,c\}\ u\ \{b,c,d\})\ n\ C[/tex]

Solve the bracket

[tex](A\ u\ B)\ n\ C = (\{a,b,c,d\})\ n\ C[/tex]

Substitute the value of set C

[tex](A\ u\ B)\ n\ C = \{a,b,c,d\}\ n\ \{b,c,e\}[/tex]

Apply intersection rule

[tex](A\ u\ B)\ n\ C = \{b,c\}[/tex]

[tex](A\ u\ B)\ n\ (A\ u\ C)[/tex]

In above:

[tex]A\ u\ B = \{a,b,c,d\}[/tex]

Solving A u C, we have:

[tex]A\ u\ C = \{a,b,c\}\ u\ \{b,c,e\}[/tex]

Apply union rule

[tex]A\ u\ C = \{b,c\}[/tex]

So:

[tex](A\ u\ B)\ n\ (A\ u\ C) = \{a,b,c,d\}\ n\ \{b,c\}[/tex]

[tex](A\ u\ B)\ n\ (A\ u\ C) = \{b,c\}[/tex]

The equal sets

We have:

[tex]A\ u\ (B\ n\ C) = \{a,b,c\}[/tex]

[tex](A\ u\ B)\ n\ C = \{b,c\}[/tex]

[tex](A\ u\ B)\ n\ (A\ u\ C) = \{b,c\}[/tex]

So, the equal sets are:

[tex](A\ u\ B)\ n\ C[/tex] and [tex](A\ u\ B)\ n\ (A\ u\ C)[/tex]

They both equal to [tex]\{b,c\}[/tex]

So:

[tex](A\ u\ B)\ n\ C = (A\ u\ B)\ n\ (A\ u\ C)[/tex]

Solving (b):

[tex]A\ n\ (B\ u\ C)[/tex]

[tex](A\ n\ B)\ u\ C[/tex]

[tex](A\ n\ B)\ u\ (A\ n\ C)[/tex]

So, we have:

[tex]A\ n\ (B\ u\ C) = \{a,b,c\}\ n\ (\{b,c,d\}\ u\ \{b,c,e\})[/tex]

Solve the bracket

[tex]A\ n\ (B\ u\ C) = \{a,b,c\}\ n\ (\{b,c,d,e\})[/tex]

Apply intersection rule

[tex]A\ n\ (B\ u\ C) = \{b,c\}[/tex]

[tex](A\ n\ B)\ u\ C = (\{a,b,c\}\ n\ \{b,c,d\})\ u\ \{b,c,e\}[/tex]

Solve the bracket

[tex](A\ n\ B)\ u\ C = \{b,c\}\ u\ \{b,c,e\}[/tex]

Apply union rule

[tex](A\ n\ B)\ u\ C = \{b,c,e\}[/tex]

[tex](A\ n\ B)\ u\ (A\ n\ C) = (\{a,b,c\}\ n\ \{b,c,d\})\ u\ (\{a,b,c\}\ n\ \{b,c,e\})[/tex]

Solve each bracket

[tex](A\ n\ B)\ u\ (A\ n\ C) = \{b,c\}\ u\ \{b,c\}[/tex]

Apply union rule

[tex](A\ n\ B)\ u\ (A\ n\ C) = \{b,c\}[/tex]

The equal set

We have:

[tex]A\ n\ (B\ u\ C) = \{b,c\}[/tex]

[tex](A\ n\ B)\ u\ C = \{b,c,e\}[/tex]

[tex](A\ n\ B)\ u\ (A\ n\ C) = \{b,c\}[/tex]

So, the equal sets are:

[tex]A\ n\ (B\ u\ C)[/tex] and [tex](A\ n\ B)\ u\ (A\ n\ C)[/tex]

They both equal to [tex]\{b,c\}[/tex]

So:

[tex]A\ n\ (B\ u\ C) = (A\ n\ B)\ u\ (A\ n\ C)[/tex]

Solving (c):

[tex](A - B) - C[/tex]

[tex]A - (B - C)[/tex]

This illustrates difference.

[tex]A - B[/tex] returns the elements in A and not B

Using that illustration, we have:

[tex](A - B) - C = (\{a,b,c\} - \{b,c,d\}) - \{b,c,e\}[/tex]

Solve the bracket

[tex](A - B) - C = \{a\} - \{b,c,e\}[/tex]

[tex](A - B) - C = \{a\}[/tex]

Similarly:

[tex]A - (B - C) = \{a,b,c\} - (\{b,c,d\} - \{b,c,e\})[/tex]

[tex]A - (B - C) = \{a,b,c\} - \{d\}[/tex]

[tex]A - (B - C) = \{a,b,c\}[/tex]

They are not equal

A box of chocolates was shared evenly between 5 people. Each person received 4 chocolates.
How many chocolates were in the box?

Answers

Answer:

20

Step-by-step explanation:

5x4=20

plz give me a thx! IF I HELPED :)

how can I subtract 9 2/5 - 8 4/5 ​

Answers

Answer:

0.6

Step-by-step explanation:

First make them into decimals so.

9.4 - 8.8 = 0.6

Step-by-step explanation:

okay so let's convert this from mixed to improper fraction

9 2/5= 47/5

8 4/5= 44/5

47/5-44/5= 3/5

SOMEONE PLEASE HELP ME

There are 72 items on Ginny's bookshelf. of the items are hardcover books, 3 Imtia of the items are softcover books. 9 • The remaining items are DVDs. How many DVDs are on Ginny's shelf?​

Answers

Answer:

There are 60 dvds.

Step-by-step explanation:

72 - 3 - 9 = 60

Sara uses 9.3 pints of white paint and blue paint to paint her bedroom walls.
3/5 of this amount is white paint, and the rest is blue paint. How many pints of blue paint did she use to paint her bedroom walls?

Answers

Answer:2.65

Step-by-step explanation:

The answer is 2.65

4. Find PQ
N
Р
5x + 16
S
R.
9x - 32
Q

Answers

Answer on= 12

Step-by-step explanation:

The value of PQ in rhombus NPQR is 76 units.

The figure above is a rhombus.

Properties of a rhombus:All the sides are equal opposite angles are equalThe diagonal are perpendicular bisector of each other.

Therefore,

PQ = NR = NP = RQ

5x + 16  = 9x - 32

5x - 9x = -32  - 16

-4x = -48

x = -48 / -4

x = 12

PQ = 5(12) + 16 = 60  + 16 = 76 units

learn more on rhombus here: https://brainly.com/question/25278931?referrer=searchResults

One bar of candy A and two bars of candy B
have 767 calories. Two bars of candy A and
one bar of candy B contain 775 calories. Find
the caloric content of each candy bar.

Answers

I'm not 100% sure, but imma have a go.

Answer:

a = 261; b = 253

Step-by-step explanation:

label candy bar A as a

label candy bar B as b

Make 2 equations.

2b + a = 767          (1)

b + 2a = 775          (2)

Solve for a in (1)

2b + a = 767          (-2b)

a = -2b + 767

Substitute for into (2)

b + 2( -2b + 767 ) = 775     (flip)

2( -2b + 767 ) + b = 775     (solve)

   −4b + 1534 + b = 775     (add b)

          -3b + 1534 = 775     (subtract 1534 from both sides)

                     −3b = −759   (divide both sides by 3)

                         b = 253

Substitute b into (1)

      a = -2b + 767              (substitute)

      a = -2 (253) + 767      (solve)

      a = -506 + 767           (add)        

      a =  261

Class intervals in a grouped frequency distribution are given as 4−11, 12−19, 20−27, 28−35, 36−43. Write the next two class intervals.
i) what is the each class interval?
ii) write the class boundaries of all classes?
iii) what are the class marks of each class?​

Answers

Answer:

{44-55}{52- 59 } are the last two interval s

Step-by-step explanation:

To get the class boundaries deduct 0.5 from the first number and add 0.5 to the second number = 4-0.5 = 3.5 = 11.5 + 0.5 = 11.5 = 3.5 -11.5 as in the fish class boundary .same for all other boundaries

LM is 3x, MN is 2x+2. M is the midpoint of LN. What is LM?

Answers

Answer:

1/2

Step-by-step explanation:

3x=(1/2)(2x+2)

3x=x+1

3x-x=x-x+1

2x=1

x=1/2

Determine if the representation below is an example of a function or not a function (1,3), (3,3), (4,5), (6,5), (7,7), (9,7)

Answers

Answer:

Yes.

Step-by-step explanation:

No x value is used twice.

Jeremiah wants to send some of his shirts to a dry cleaner. he usually takes his clothes to Spot-Less Dry cleaners, where he pays $4.50 per shirt. He sees a sign at No Mess or Stress Dry Cleaners that says it's $21.00 to have 4 shirts cleaned. Which is the better deal?

Answers

answer:spot-less

Step-by-step explanation:

21.00 divided by 4 is 5.25 so you'd be payingmore at "no mess or stress dry"

Find the volume of the cylinder to the nearest tenth

Answers

Answer:

1131 m^3

Step-by-step explanation:

Formula is π r^2h

then substitute the values r=6,h=10

1130.97

then round the number by nearest tenth.

which is 1131.

What is the Area of the right angle

Answers

Answer:

141.96

Step-by-step explanation:

The area or solution for the area of a triangle is base* height divided by 2 so what I did was 31.2cm as the base and 9.1 as the height and I multiplied them together and then I divided by 2! Hope this helped!

Please Help!, Brainliest to whoever helps

Answers

B for sure!!!!!!!!!!!!!!!!!!!

true or false
1) m<1=50 degrees
2) m<2=130 degrees
3) y=26 degrees
4) x=4 degrees
5) m<1+m<3=180 degrees

Answers

Answer:

1. true

2. false

3. false

4. false

5. false

Step-by-step explanation:

Pls help need help with answer b

Answers

Answer:

Field hockey has a higher variation of heights.

There is more of a difference between the different heights in field hockey.

PLEASE HELP ASAP!!!! GOING TO GIVE 30 POINTS

Answers

Answer:

The second answer option

Step-by-step explanation:

Lmk if you need explanation

For positive acute angles A and B, it is known that sin A = 8/17 and cos B = 24/25
Find the value of sin(A + B) in simplest form.

Answers

Answer:

Step-by-step explanation:

Here we use the SUM FORMULA:  sin(a + b) = sin a cos b + cos a sin b

sin(A + B) = sin A*cos B + cos A*sin B.  We are not given cos A or sin B and so must find them using the Pythagorean Theorem x^2 + y^2 = z^2.

Looking at sin A = 8/17, we see that the "opposite side" is 8 and the "hypotenuse" is 17.  Then (adjacent side) = √(17² - 8²) = 15; that is, the side adjacent to Angle A is 15.  Thus, cos A = 15/17 and sin A = 8/17.

We find sin B similarly.  cos B = (side adjacent to B)/25  =  24/25.  Therefore the side opposite B is √(25² - 24²) = 7.  Thus, sin B = 7/25 and cos B = 24/25.

Then sin (A + B) = sin A*cos B + cos A*sin B

                           = (8/17)*(24/25) + (15/17)(7/25)

Here there are two products of fractions.  This product (above) can be rewritten as

                                                    8(24) + 15(7)             (3)(64) + (3)(5)(7)

= sin A*cos B + cos A*sin B = --------------------------- = --------------------------

                                                            17(25)                         17(25)

Find the value of x in the triangle shown below 8 10

Answers

Answer:

x = 6

Step-by-step explanation:

pythagorean theorem

a^2 = c^2 - b^2

a^2 = 10^2 - 8^2

a^2 = 100 - 64

a^2 = 36

sqrt a^2 = sqrt 36

a = 6

CHECK:

6^2 + 8^2 = 10^2

36 + 64 = 100

yes.

how much greater is 620,000 than 62?​

Answers

Answer:

10,000

Step-by-step explanation:

620,000/62 = 10,000

Find the sum of these

Answers

Step-by-step explanation:

5x² - 8x + 2 + x² - 6x +3

= 6x²- 14x + 5

pls help me and I will mark u as brainliest plsssss plsssss please answer momoo anyone

Answers

It’s B you wanna start at the foot of the ladder

What does not contribute to the destruction of the rainforest in Brazil? farming and ranching cutting down trees to sell the wood constructing a highway having heavy rains​

Answers

Answer:

heavy rains

Step-by-step explanation:

it makes the forest grow!!1!!1!!!!11111!1!!

What are the next 4 multiples of 4/8 in a fraction

Answers

Answer:

8/16, 12/24, 16/32, and 20/45

Step-by-step explanation:

Evaluate the following for f(x) = 3(2)^x

1. f (2) =

2. f (-1) =

3. f (10) =​

Answers

Answer:

1. f (2) = 3 x 2^x-1  

2. f (-1) = -3 x 2^x

3. f (10) =​ 3 x 2^x/10

         

Step-by-step explanation:

Courtney made a 5.5 foot ramp
to help her dog get in her minivan.
If the back of her van is 3 feet
from the ground, what will be the
angle of elevation from the base of
the ramp to the van?

Answers

9514 1404 393

Answer:

  33°

Step-by-step explanation:

We assume the 5.5 foot measurement is the length of the ramp surface. It will be the hypotenuse of a right triangle with the 3 ft side opposite the angle of interest. The applicable relationship is ...

  Sin = Opposite/Hypotenuse

  sin(angle) = (3 ft)/(5.5 ft)

  angle = arcsin(3/5.5) ≈ 33.0°

The angle of elevation of the ramp is about 33°.

write an exponential formula of the form f (t)= a×b^t to represent the following situation. assume t is in years. The beginning population is 27, 000, decreasing by 3.5% annually. f(t)=__________​

Answers

Answer:

[tex]f(t)= 27000 * 0.965^t[/tex]

Step-by-step explanation:

Given

[tex]a = 27000[/tex] -- initial

[tex]r = 3.5\%[/tex]

Required

The exponential equation

The exponential equation is

[tex]y =ab^t[/tex]

Where

[tex]b=1 -r[/tex]

We used minus, because the rate decreases..

So, we have:

[tex]b=1 -3.5\%[/tex]

[tex]b=1 -0.035[/tex]

[tex]b=0.965[/tex]

So:

[tex]y =ab^t[/tex]

[tex]y = 27000 * 0.965^t[/tex]

Hence:

[tex]f(t)= 27000 * 0.965^t[/tex]

The chemical element einsteinium -253 naturally loses its mass over time . A sample of einsteinium-253 had an initial mass of 320 grams when we measured it. The relationship between the elapsed t, in days, and the mass,m(t), in grams left in the sample is modeled by the following function: M(t)=320•(0.125)^t/61.4 complete the sentence: the sample loses 87.5% of its mass every ___ days.

Answers

Answer: 61.4

Step-by-step explanation:

The graph of a function is shown on the coordinate plane below.

Which statement correctly describes the function on a given interval?

Answers

Answer: D

Step-by-step explanation:

I did it

The statement that correctly describes the function is:

The function is decreasing and nonlinear from x = 4 to x = 11.

Option D is the correct answer.

What is a function?

A function has an input and an output.

A function can be one-to-one or onto one.

It simply indicated the relationships between the input and the output.

Example:

f(x) = 2x + 1

f(1) = 2 + 1 = 3

f(2) = 2 x 2 + 1 = 4 + 1 = 5

The outputs of the functions are 3 and 5

The inputs of the function are 1 and 2.

We have,

From the graph,

We see that,

The function is increasing and nonlinear from x = -7 to x = -4.

The function is constant and linear from x = -4 to x = 1.

The function is increasing and nonlinear from x = 1 to x = 4.

The function is decreasing and nonlinear from x = 4 to x = 11.

Thus,

The function is decreasing and nonlinear from x = 4 to x = 11.

Learn more about functions here:

https://brainly.com/question/28533782

#SPJ2

which of the following is a example of a proportional relationship
*photo is down there
show proof for brainliest

Answers

Answer:

The third one

Step-by-step explanation:

You multiply x by 6 to get y. 1x6=6, 2x6=12, 3x6=18.

Other Questions
The odds in favor of an event are 8 to 3. What is the probability of the event? Threat Awareness and Reporting Program (TARP) im marking brainiest What are some examples of mutual aid institutions? Write an inequality that represents the sentence:14 fewer than a number is at least -8.andthe product of a number and 5 is no more than 8. Por favor ayuda con el grfico y la tabla pls cos 0 = 0.8192 A = 45H = ? How long is a 1 sentence? Why was their aunt annoyed at The Bachelor? Express the given product as a sum containing only sines or cosines.sin (50) cos (20)The zeros are thetas btwPls help I don't have much time In rectangle ABCD, point E lies half way between sides AB and CD and halfway between sides AD and BC. If AB=11 and BC=6, what is the area of the shaded region? Write your answer as a decimal, if necessary. Do not include units in your answer. question 5 billings upholstery has defined a problem it needs to solve: find a more environmentally friendly way to produce its furniture. a data analyst gathers relevant data, analyzes it, and uses it to draw conclusions. the analyst then shares their analysis with subject-matter experts from the manufacturing team, who validate the findings. finally, a plan is put into action. this scenario describes what process? Included among the defendants of the Doctor's Trial was Viktor Brack, an SS colonel. Brack was not a physician and had no medical background. Since the trial was mainly about the euthanasia program and Aktion T-4, why was he MOST likely included as a defendant? A. He was probably studying to be a doctor at the camps. B. He was probably a Nazi Party official who helped organize the programs. C. He was most likely the chemist who invented Zyklon-B gas used on patients. D. He may have sold the buses to the Nazis for use in transporting patients. What problem with the vice presidency was the twenty-fifth amendment meant to solve?. What are two factors used to determine a credit score? Why is the setting of The Great Gatsby so important? How long can you stay on sickness benefits? Assessing the functioning of immune cells involves _____. question another sample of eggshell reacts completely with 4.0ml of an hcl(aq) solution of unknown concentration. if the reaction produced 0.095atm of gas, the concentration of the hcl(aq) solution was at least What was the original purpose of sonar?