write a C++ program to implement an algorithm that generates the factorial representation of a natural number k. output to console the factorial representation of k. Take advantage of repeated division rather than seeking the largest t! less than or equal to k and then having to worry about whether you need any leading zeros.
then write a C++ program that generates the permutation of rank k in the lexicographic order of the permutations of an n-set. You must first prompt the user for the value of n, then for value(s) of k. Call this program LexRank2Perm. Remember to use the alphabet for the elements of your permutation. Your code the first question provides the first step in this process. and Write a C++ program that generates all permutations of an n-set using the Johnson-Trotter algorithm. output one permutation per line. Clearly run for small values of n given how quickly n! grows. Don't forget to use a, b, c, ... as the symbols permuted.
Dear Hope, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order
Leave a comment