QUESTION 5
Suppose that you have the following pseudo-code:
1: class MAPPER
2: method MAP(string t, integer r)
3: EMIT(string t, integer )
1: class REDUCER
2: method REDUCE(string t, integers [r,r...])
3: sum = 0
4: cnt = 0
5: for all integer r in integers [r1,r2,...] do
6: sum = sum + r
7: cnt = cnt + 1
8: Tavg = sum/cnt
9: EMIT(string t, integer raeg)
Suppose that you will process the following input with the pseudo-code:
string t: dallas austin houston dallas houston arlington dallas austin austin
integer r: 3 1 6 9 5 3 8 3
Considering the pseudo-code and input given above, please answer the following questions:
(A) How many times will the method MAP be called overall?
(B) How many times will the method REDUCE be called overall?
(C) Please list below all the outputs emitted by the REDUCE call(s).
(D) If you were asked to improve the performance (in terms of network resources taken by your job) of this implementation, what changes would you make in the pseudo-code expressed above? Please elaborate/justify your answer. If you cannot see the pseudo-code above, please access: [link]