Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a recurrence relation describing the worst case running time of each the following algorithms and make a guess about the asymptotic complexity of the

Write a recurrence relation describing the worst case running time of each the following
algorithms and make a guess about the asymptotic complexity of the functions defined by
the recurrence relation using either expanding into a series or a recursion tree.
A[idotsj] represents an array of n=j-i+1 numbers starting at index i and ending at
index j and A[k] represents the value at index k.
1.) FUNCTION F1(A[1dotsn])
IF n5 THEN RETURN(A[n])
xlarr0
FOR ilarr1 TO 5 DO
BEGIN (FOR i)
FOR jlarr1 TO n-4 DO
A[i]larrA[j]+A[j+2]
xlarrx+F1(A[1dots|??n2??|])
END
RETURN (x)
2.) FUNCTION F2(A[idotsj])
nlarrj-i+1
IF n1 THEN RETURN (A[i])
xlarrF2(A[idots|??i+2n3??|])
FOR ilarr|??n4??| TO |??n4??|+12 DO
xlarrx+A[i]
RETURN (x)
3.)FUNCTION F3(A[1dotsn])
IFn1 THEN RETURN (A[1])
FOR ilarr1TOnDO
FOR jlarr1TO|??n3??|DO
,A[i]larrA[i]-A[j]
xlarrF3(A[1..|??3n5??|])
RETURN(x)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Upgrade Migration And Transformation Tips And Techniques

Authors: Edward Whalen ,Jim Czuprynski

1st Edition

0071846050, 978-0071846059

More Books

Students also viewed these Databases questions