Generating all Variations and Permutations

Update: adding a generic method for printing all variations and
permutations of an array