2010-11-28, 03:18 AM
Well, yeah. That method works. But it's either way inefficient or somewhat inaccurate (due to scaling everything down).
Hmm.
Well in the simpler version, you have the following:
e(n) = 1 + 1/size * (e(n-a) + ... + e(n-b+1))
e(n-1) = 1 + 1/size * (e(n-a-1) + ... + e(n-b))
and so:
e(n) = e(n-1) + 1/size * (e(n-a) - e(n-b))
So by extension:
c(n) = 1 + 1/size * (e(n-a1) + ... + e(n-b1+1))
c(n-1) = 1 + 1/size * (e(n-a1-1) + ... + (n-b1))
c(n) = c(n-1) + 1/size * (e(n-a1) - e(n-b1))
So it should work...
Edit: I ran the numbers (they match yours) and something is wrong. e(n) plateaus at 2.4 with these numbers, even as n increases to infinity.
Stereo Wrote:I'm not sure this approach is valid though since it's weird c(4) < nc(4). Probably better to work through the logic on the recursive definitions for nc() and c().
Hmm.
Well in the simpler version, you have the following:
e(n) = 1 + 1/size * (e(n-a) + ... + e(n-b+1))
e(n-1) = 1 + 1/size * (e(n-a-1) + ... + e(n-b))
and so:
e(n) = e(n-1) + 1/size * (e(n-a) - e(n-b))
So by extension:
c(n) = 1 + 1/size * (e(n-a1) + ... + e(n-b1+1))
c(n-1) = 1 + 1/size * (e(n-a1-1) + ... + (n-b1))
c(n) = c(n-1) + 1/size * (e(n-a1) - e(n-b1))
So it should work...
Edit: I ran the numbers (they match yours) and something is wrong. e(n) plateaus at 2.4 with these numbers, even as n increases to infinity.

