Give the number of calls to put and get issued by FrequencyC

Give the number of calls to put() and get() issued by FrequencyCounter, as a function of the number W of words and the number D of distinct words in the input.

Solution

put() function is to write something to the screen. Therefore, to print a total of D distinct words, the numnber of calls required for put() is D.

get() function is to read something from the keyboards. Therefore, to read a total of W words, the number of calls required for get() is W.

 Give the number of calls to put() and get() issued by FrequencyCounter, as a function of the number W of words and the number D of distinct words in the input.

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site