This is java Client. Write a client program Subset.java that takes a command-lin
ID: 3588347 • Letter: T
Question
This is java
Client. Write a client program Subset.java that takes a command-line integer k ; reads in a sequence of strings from standard input using StdIn.readString(); and prints out exactly k of them, uniformly at random. Each item from the sequence can be printed out at most once.
Your program must implement the following API:
You may assume that 0 k N, where N is the number of strings on standard input.
Performance requirements: The running time of Subset must be linear in the size of the input. You may use only a constant amount of memory plus either one RandomizedBag or one Dequeue , of maximum size at most N.