- #1
gamow99
- 71
- 2
I'm trying to figure out how many times my computer will have to loop through an array. I'm building a logic calculator so it's checking contradictions. If there are four sentences, a b c d, then one has to check the following combinations to see if there is a contradiction
ab
ac
ad
bc
bd
cd
The equation seems to be, let n = the number of sentences:
(n - 1) + (n - 2) + (n - 3)
But that's not a good equation because it does not inform us how many things to add together.
If there are six sentences then the equation would be
(n - 1) + (n - 2) + (n - 3) + (n - 4) + (n - 5)
There has to be a better way to write that equation.
ab
ac
ad
bc
bd
cd
The equation seems to be, let n = the number of sentences:
(n - 1) + (n - 2) + (n - 3)
But that's not a good equation because it does not inform us how many things to add together.
If there are six sentences then the equation would be
(n - 1) + (n - 2) + (n - 3) + (n - 4) + (n - 5)
There has to be a better way to write that equation.