writting this :
N = args[1].split("\\s+").length;
with commandline argument like : echo "A B C D E F G H I" | java Subset 3
, will this consume similar memory as would have been the case if i parsed the "A B C D E F G H I"
string using .split()
into a String array ?
my assingment states that (as a challenge) the student (me) can try to display K strings ( K = 3 in the above cmd line ) uniformly at random , from the N string ( N = 9 above , A to I ) input , while consuming memory proportional to K , and not N.
so thats basically what im trying to do.