Name (print clearly): _________________________________________________
Student ID (print clearly; 1 digit per underline): _____ _____ _____ _____ _____ _____
CSE 231s Quiz 10: MapReduce WordCount
Recall the word count example from your RiceX prep and given the type declarations for BiConsumer and TextSection below, write pseudocode for map()
which emits the non-empty words converted to lower
case as keys, each associated with the value 1.
public interface BiConsumer<T, U> {
void accept(T t, U u);
}
public class TextSection {
public String[] getWords();
}
public class WordCountMapper implements Mapper<TextSection, String, Integer> {
@Override
public void map(TextSection textSection,
BiConsumer<String, Integer> keyValuePairConsumer) {
}
}
Write pseudocode for a reducer to go with your word count mapper below:
public class IntegerSumClassicReducer implements ClassicReducer<Integer, Integer> {
@Override
public Function<List<Integer>, Integer> finisher() {
return new Function<List<Integer>, Integer>() {
@Override
public Integer apply(List<Integer> list) {
}
};
}
}
Find the index of a minimum character in an array that is not the character 'b'.
If none of the characters match, then return -1.
As examples:
- fourscoreandsevenyearsago would return 9 (which is 'a')
- tobeornottobe would return 3 (which is 'e')
- bbb would return -1
- zzz would return 0 (which is 'z')
public static int findNonBMinimumIndex(char[] chars) {
}