Question: Consider the following algorithm: FUNCTION foo ( n ) s : = 0 FOR i : = 1 TO n DO s : = s
Consider the following algorithm:
FUNCTION foo n
s :
FOR i : TO n DO
s : s i i
RETURN s
Analyse the algorithm and determine:
What is its basic operation?
How many times is the basic operation executed?
What is the eciency class of this algorithm?
What does this algorithm compute?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
