i need to verify that the following algorthims works on the list 2, 3,6,2,6
count := 0
for i:= 2 to n do
for j:=1 to (i-1) do
count := count +1
I'm reviewing your algorithm, not your data. I made up my own data.
Why would you need an algorithm to count pairs if the data you provided was the entire universe of data? Just count them. Pair of 2's Pair of 6's. There, 2 pairs. Done.
Should your algorithm work with ANY data, or just some clear subset, such as that you have provided? If it needs to work on ANY data, then you'll get some double counting. If you can guarantee that there never will be a trio or a quartet or worse, then perhaps you are done.