On 8/3/16, 5:58 PM, "Justin Mclean" <jus...@classsoftware.com> wrote:

>Hi,
>
>> If i compare record 20 to record 1030 and find them to be comparable and
>> decide to calculate the distance between them, then why should i
>>recompare
>> record 1030 to 20 when the time comes in the loop?
>
>Correct theres no need to.

I could be wrong, but doesn't this mean the inner loop doesn't have to
start at 0 but at i?  If so, that would cut out a lot of comparisons.

For (i = 0; i < n - 1; i++)
  For (j = i + 1; j < n; j++)
    Test(i, j)

IF n = 4, this will test:

0,1
0,2
0,3
1,2
1,3
2,3


HTH,
-Alex

Reply via email to