If you don’t know anything about the file structure (for example, regardless of whether they are sorted or not), there are many different approaches that you could take to solve the problem, which, depending on your limitations on memory and space usage, could be , what are you looking for.
, - . -. . , -. , . O (m) ( m - ) & Omega; (m + n) , , , , -. ( ) .
, , . . -. , , . - . runtime & Omega; (mn/b), b - ( O (m/b) n ). , , , .
, , (, , , ). , , . , :
O (n log n) O (n), , . , O (1) (, ), . , n m, O (mn log n), O (m). O (mn), O (m). - (, 16 32 ). , - , , , , , - O (1).
, (, 8 ), - 64 . , , - - ( -, ..) , -, , .
, !
Woohoo! 1000- !: -)