Amazon Interview Question
Software Engineer / DevelopersI have two large files (10 MB) each how do you compare them and remove common elements in a file.
- Trie
- Hashing with node representing a BST
Any comments?
If I have understood the question correctly, may be a simple unix command would do
comm -3 file1 file2 > fil3.
-3 will suppress common part from file1 and file2
Sort the elements from both the files using external sorting algorithm, and then implement a merge kind of function taking one element from both the file...printing the similar elements only once..(Sorting makes it easier in the sense that the common elements appear together ... refer to merge function in the mergesort algorithm.)
Sort the elements from both the files using external sorting algorithm, and then implement a merge kind of function taking one element from both the file...printing the similar elements only once..(Sorting makes it easier in the sense that the common elements appear together ... refer to merge function in the mergesort algorithm.)
For auto completion a trie would be good
- Anonymous May 21, 2010