What is the asymptotic time complexity of the following algo

What is the asymptotic time complexity of the following algorithm? (Show the 5 step process to derive your results)

Procedure proc(<x1,x2,x3....xn>  

if n = 1 then return (1)

else

for i <-- 1 to m do

yi <--X3i-1

zi <-- X3i

return( proc(<y1,y2....ym>)+ proc(<z1,z2......zm>))

Solution

O(n)->As it depends on size of n and number of loops runs on the size of n. i.e m=n/3.

where O(n/3)=O(n). constant 3 is removed.(Rule of assymtotic construction).

therfore it is a linear time.

What is the asymptotic time complexity of the following algorithm? (Show the 5 step process to derive your results) Procedure proc(<x1,x2,x3....xn> if n =

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site