|
This post was updated on .
T(n)= no. of matches to be played for n players
T(1)= 0 ,T(2)=1,T(3)=2
T(2)-T(1)=1
T(3)-T(2)=1
Now if n is even, we can see
T(n) = n/2 + T(n/2)
Now if n is odd, we can see
T(n) = (n-1)/2 + T((n+1)/2)
Now we can prove by mathemathical induction that T(n)-T(n-1)=1
Suppose upto n-1 terms ,it follows that T(k)-T(k-1)=1
If n is even =2k T(n) - T(n-1)= n/2 + T(n/2) -[(n-2)/2 + T((n-1+1)/2)] { since n is even,n-1 is odd }
= 1 always
If n is odd =2k + 1 T(n) - T(n-1)= (n-1)/2 + T((n+1)/2) - [ (n-1)/2 + T(n-1/2)] { since n is odd,n-1 is even}
= T((n+1)/2)- T(n-1/2)
replacing n by 2k+1,
=T(k+1) - T(k)
since upto n-1 terms it follows T(k)-T(k-1)=1 and k<n-1 so T(k+1)-T(k)=1
Hence proved by mathematical induction that T(n+1) - T(n)=1
This is an AP with a=0 since T(1)=0
Hence T(n) = n-1
|