Algorithm Analysis -


i have algorithm following pseudocode:

r(n) if(n = 1)   return 1 else   return(r(n-1) + 2 * n + 1) 

i need setup recurrence relation number of multiplications carried out algorithm , solve it.

is following right?

r(1) = 0 r(n) = r(n-1) + n^2 

you performing 1 multiplication per step. therefore, relation be:

r(n) = r(n-1) + 1 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -