Create a new function ‘kpermutations(k,n)’ which returns the list of all k-permutations of (n), in lex order.
Create a new function ‘kcombinations_withrep(k.n)’ which returns the list of all k-combinations with repetition of In), in lex order.
Bonus : Create a new function Ikpermuations justone(k,n,r). which returns the r-th k-permutation of In], without creating any other k-permutations of aside from the one you are looking for! (To save space)
#Sales Offer!| Get upto 25% Off: