1. Engineering
  2. Computer Science
  3. finally your tasks a write a c function isperm which...

Question: finally your tasks a write a c function isperm which...

Question details

Finally, your tasks A. Write a C++ function is_perm which determines if a given array of n integers is a permutation of (e..n-1}. B. Write a function which takes a permutation as an array of n integers and constructs its inverse (also as an array). Your function will allocate storage for the inverse array and returns it as an integer pointer. If the array it receives is not a permutation of (e..n-1), it returns nullptr instead Templates given below. bool is_perm(int all, int n) int perm2inverse(int all int n) if(lis_perm(a, n)) // to get you started. return nullptr; // otherwise, a] is a permutation of e..n-1; allocate and populate its / nverse array (and return it)

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution