Random commentary about Machine Learning, BigData, Spark, Deep Learning, C++, STL, Boost, Perl, Python, Algorithms, Problem Solving and Web Search
Is this equivalent to generate all the combinations of order k and sort the generated strings before to print them?Example:string = "abcd"k = 3k-permutations: a,b,ca,c,bb,a,cb,c,ac,a,bc,b,aThese strings sort all the same way, i.e. "a,b,c" So, the idea is to generate all the possible combinations (ranging K from 0 to N), remembering to sort the string right before to emit it to the console.Thoughts?I posted the algo to generate all the combination of string recently on this blog. Findi it and change the print line as follow:System.out.println(sort(str));Ciao!
anything better? this is a little hard