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.

4 Years
Discussion Span
Last Post by somjit{}

answer to my original question is : yes . which i kinda guessed will bethe case anyway.
im reading into this . turns out to be what i need here.

Thread solved i suppose.

Edited by somjit{}

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.