If I have n
rows in a database, and I want to compare every row against each other, how many loops (or processes) would I need to do.
Is it n2? (so if I have 30,000 rows then it would be 900,000,000)
Or is it:
for (i = 0; i < 30000; i++) {
for (j = i + 1; j < 30000; j++) [
// Process
}
}
If it is the later, then how many processes is that (and is there an equation to work it out, given n
)?
Also if I have to process each row y
times, how does that affect the calculations?
I need to check a database of companies for possible duplicates. To check, they want to do a similarity check on common fields like business name, phone number, etc. If a field difference is under a certain percentage threshold, then mark it as a possible duplicate. I can code this fine by my self, but I am curious about he performance ramifications.