Quantcast
Channel: stardot.org.uk
Viewing all articles
Browse latest Browse all 2965

programming • Re: Weekend coding challenge: Turing's tricky tape teaser

$
0
0
It's pretty clear that the odd-numbered cases follow a D=(N+1)/4 pattern with considerable accuracy. The even-numbered case is a lot less obvious. So I was half-right. [-X
Yeah, so for even- and odd-numbered cases, the sum of seek distances from any element is the same, which simplifies things immensely.

For even-numbered cases, the sum of seek distances from a given element is T(N/2) + T(N/2 - 1).
It's the same for each element, so multiply by N, and we get N^3 / 4.
So divide by the number of possible seeks, N(N-1), and we get:

N^2 / 4(N-1)

For odd-numbered cases, the sum of seek distance from a given element is T((N-1) / 2) * 2
It's the same for each element, so multiply by N, and that simplifies to N(N+1)(N-1) / 4
And finally dividing by N(N-1) and we get:

(N+1) / 4

Yay! That seems to correspond with Diminished's experimental findings.

Statistics: Posted by Rich Talbot-Watkins — Sun May 04, 2025 7:39 pm



Viewing all articles
Browse latest Browse all 2965

Trending Articles