Name: Anonymous 2009-01-19 18:45
Recently, a bug was found in the software my employer makes in which the same record number was issued to two or more clients, so that there would be different records with the same number on more than one client.
The bug was fixed, but we wanted to find out if any of our customers had been affected by this bug. A normal directory compare wouldn't work, because all the software we found could only compare between two folders; however, we need to compare the folders of multiple clients to see if any of them share file names with any others, which would be an indication that the bug had occurred.
So, I came up with an algorithm and wrote the code to do just that. The C# program I wrote can find 200,000+ duplicated records in 60+ network folders in about two minutes.
Challenge: come up with an algorithm that, given multiple folders, gives a list of file names shared between two or more folders, and for each duplicated file name found, a list of folders in which it is found.
Example:
Folders:
Folder1\
1.txt
2.txt
3.txt
Folder2\
3.txt
9.txt
100.txt
Folder3\
2.txt
9.txt
55.txt
Results:
2.txt
Folder1
Folder3
3.txt
Folder1
Folder2
9.txt
Folder2
Folder3
The bug was fixed, but we wanted to find out if any of our customers had been affected by this bug. A normal directory compare wouldn't work, because all the software we found could only compare between two folders; however, we need to compare the folders of multiple clients to see if any of them share file names with any others, which would be an indication that the bug had occurred.
So, I came up with an algorithm and wrote the code to do just that. The C# program I wrote can find 200,000+ duplicated records in 60+ network folders in about two minutes.
Challenge: come up with an algorithm that, given multiple folders, gives a list of file names shared between two or more folders, and for each duplicated file name found, a list of folders in which it is found.
Example:
Folders:
Folder1\
1.txt
2.txt
3.txt
Folder2\
3.txt
9.txt
100.txt
Folder3\
2.txt
9.txt
55.txt
Results:
2.txt
Folder1
Folder3
3.txt
Folder1
Folder2
9.txt
Folder2
Folder3