The complexity of an ineffective division and conquest algorithm

A size instance nis divided into pβ‰₯2instances of each size n-a, where it ais small integerand pis constant. The estimated cost of this transaction (i.e. division by instances) is unit, sC(0)=1.

I am trying to find the complexity of this design. It's hard for me to put words in the equation, this is what I think recursion should look like this:

C(n) = (n-a)*C(n/p) + 1

Is it correct?

+4
source share
3 answers

I think it will be something like this:

C(n) = (p)*C(n-a) + 1

, "pβ‰₯2 n-a" . , C(n-a) p . , - p*C(n-a). . C(0) = 1, .

+1

, , - " ", .

a=1 p=2. n-1, 1 . 1 n=1, .. C(1)=1,

C(1)=1
C(2) = 2*C(1) + 1 = 3
C(3) = 2*C(2) + 1 = 7
C(4) = 2*C(3) + 1 = 15

... , C(n) =2^n - 1. a 1, : n/a n.

, a " ", p ""? , . "", .
0

, C (n) = pβ‹…C (n-a) + 1 .

,

C (n) = Ξ£ i = 0, ..., n / a p i = p n / a + 1 - 1

So, C (n) is in O (p n / a ), which is exponential in n.

0
source

All Articles