Question
Programming in Go: Write a Smash function takes the following inputs: io.Reader4 to read text data, and a smasher function that returns a uint32 given
Programming in Go:
Write a Smash function takes the following inputs: io.Reader4 to read text data, and a smasher function that returns a uint32 given a word. smasher may return the same output uint32 value for dierent input words. The output of Smash is a map[uint32]uint that stores the count of the number of words that are mapped to the same value by smasher. Words in a string are separated by whitespace and newline. As an example, suppose smasher maps a word to its length. Then for the input a c d ab abc bac abcd dcba, Smash will return the map {1: 3, 2: 1, 3: 2, 4: 2}. On the other hand, if the given smasher were to map each word to unique output, then Smash would return the count of each word in the input io.Reader.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started