What is the fastest way to compare two list of items?

Posted by edude05 on Stack Overflow See other posts from Stack Overflow or by edude05
Published on 2010-03-14T02:22:06Z Indexed on 2010/03/14 2:25 UTC
Read the original article Hit count: 299

Filed under:
|
|

I have two folders with approximately 10,000 files each. I'd like to write a script or program that can tell me if these folders are in sync and then tell me what files are missing from each to make them in sync.

Therefore, after generating a list of files, what is the fastest algorithm to sort them for unique files? What I'm thinking right now is comparing the first file on each list then if they are different remove one until they are the same, then remove both from the list (because they are not unique.)

Is there a faster algorithm then this?

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about scripting