How do you find the common lines between two large files?

How do you find the common lines between two large files?
Answer
When you have more than 2 files, iterate over one file and build a new trie from the matches.
…
  1. Sort just 1 file (#1).
  2. Walk through each line of the next file (#2) and do a binary search on the #1 file (based on the number of lines).
  3. If you find the string; write it on another temp file (#temp1).
 

Tìm kiếm

Back
Top