Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started