Reputation: 377
Maximum number of non-attacking pairs of queens in 8-Queens problem is given by 8 × 7/2 = 28. Can someone explain how it is 8x7/2?
Upvotes: 3
Views: 3086
Reputation: 76
A non attacking pair is when two queens don't attack each other.For max condition no queen attacks any other queen, so number of non attacking pairs
1st queen would have = 7 2nd queen would have = 6 (exclude the pair with the 1st queen as its already counted in step 1)
Similarly, 3rd queen would have = 5
Thus, total number of non attacking pairs for 8 queens would be = 7+6+5+4+3+2+1+0 =28
Upvotes: 3
Reputation: 14104
Here is another thought process: We have 8 queens and you want to know every possible attacking pair on the board so we have 8 choose 2 or
8!/((8-2)!*2!) = 28
Upvotes: 1