Saturday, December 6, 2014

Algorithm to print combinations of elements in given order (Written in Java)

This is an algorithm to print combinations of elements in an array following the lexicographic order. For example if the given array is

{ 'a', 'b', 'c', 'd'}

then the answer should be

 ab, ac, ad, bc, bd, abc, abd, acd, bcd, abcd.


 Given below is the implementation:

No comments:

Post a Comment