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)

Algorithm 2)

Algorithm 3)

Algorithm 4)

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
Get step-by-step solutions from verified subject matter experts
