Question: Inverse permutation. Write a program that reads in a permutation of the integers 0 to n-1 from n command-line arguments and prints the inverse permutation.
Inverse permutation. Write a program that reads in a permutation of the integers 0 to n-1 from n command-line arguments and prints the inverse permutation.
(If the permutation is in an array a[], its inverse is the array b[] such that a[b[i]] = b[a[i]] = i.) Be sure to check that the input is a valid permutation.
Step by Step Solution
3.48 Rating (155 Votes )
There are 3 Steps involved in it
Okay we can solve this task by using Python Here we can use the list data structure to hold the perm... View full answer
Get step-by-step solutions from verified subject matter experts
