MapReduce implementation in Go

How do I solve this interview question.

There is a text file with a lot of words, and the size of the file is 100GB, you need to 
find the first unique word.
Limits: use less than 16GB memory

       Example, Here is the content of the file:
       foo bar chaos hello hi foo bar

This program should output “chaos" as it is the first unique work.

How do I solve this using MapReduce.

There is no MapReduce in go, you can use a for loop and an “outer” variable.

Or are you talking about the programming model rather than the function as known from functional programming languages?

Actually I am having problem in dividing the 100GB file in smaller chunks.

How are they separated?

Use that as a natural border when reading the file from a reasonably sized buffer.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.