Hi All,
Question 1:
The variant for question 5-10 go like this: Given an array A of integers representing a permutation, update A to represent the inverse permutation using only constant additional storage.
What does inverse mean in that context? Let’s say A is {2, 0, 1, 3} which represent a permutation Array. Would the inverse permutation be {3, 1, 0, 2}? I don’t understand the question. What’s an example of an inverse permutation?
Question 2:
The variant for Question 5-11 ask to compute the kth permutation under dictionary ordering starting from the identity permutation.
All I can think is use the algorithm given in the book and loop k time. Therefore the time complexity would be O(kn). It will be O(n^2) at worst.
Is it possible to design a tighter algorithm that can directly gets you to the kth permutation enumeration all the k - 1 permutation that’s not even needed before reaching to the kth one? I mean a O(n) algorithm.
Thanks!
JC