Question: For all 4 algorithms below, show why they use the given number of multiplications. Algorithm 1) Algorithm 2) Algorithm 3) Algorithm 4) procedure Alg(n: positive

For all 4 algorithms below, show why they use the given number of multiplications.

Algorithm 1)

For all 4 algorithms below, show why they use the given number

Algorithm 2)

of multiplications. Algorithm 1) Algorithm 2) Algorithm 3) Algorithm 4) procedure Alg(n:

Algorithm 3)

positive integer) a:=1 b =1 for i:=1 to n forj:=1 to n

Algorithm 4)

for k:=1 to n a := 2.a b:=3.6 C:= a + b

procedure Alg(n: positive integer) a:=1 b =1 for i:=1 to n forj:=1 to n for k:=1 to n a := 2.a b:=3.6 C:= a + b return c Show the this algorithm uses (n3) multiplications procedure Alg(n: positive integer) a:=1 b:=1 for i:=1 to n for j :=1 to 1000000 for k:=1 to n a:=a.b b:= 3.b return a Show the this algorithm uses O(na) multiplications procedure multiplications(n: positive integer) t:=1 for i :=1 ton for j :=1 to i t:= 2.t return t Show the this algorithm uses O(na) multiplications procedure multiplications(n: positive integer) t:=1 for i:=1 to n j:=1 while j

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!