VMWare Inc Interview Question
Software Engineer / DevelopersAre we sure this is an algorithmic question ? May be *nix Operating systems may come handy with its paste and/or join & sort commands. Any suggestions ?
1. For case 2, Read all the words into an array
2. Sort the array using quick sort
3. Open a handler to empty file 3, Read words sequentially from file 1.
4. Locate the word using binary search in the sorted array.
5. Copy the line from the file and write it into file 3 at line = array index. i.e if the word is found at array index 25, the line read from file must be written at the 25th line in file 3.
for case 1 the answer is pretty simple and straightforward: Use mergesort...
- Anonymous August 18, 2009