views:

34

answers:

1

Two files each of size terabytes. A file comparison tool compares ith line of file1 with

i th line of file2. if they are same it prints. which datastructure is suitable.

  1. B-tree
  2. linked list
  3. hash tables
  4. none of them
A: 

You need to be able to buffer up at LEAST a line at a time. Here's one way:

While neither file is at EOF:
     Read lines A and B from files one and two (each)
     If lines are identical, print one of them

Translate into suitable programming language, and problem is solved.

Note that no fancy data structures are involved.

Ian