Given two arrays, a real array v = (v1, v2, . . . , vn) and an integer permutation array p = (p1, p2, . . . , pn) of integers 1, 2, . . . , n, can we form a new permuted array v = (vp1 , vp2 , . . . , vpn ) by overwriting v and not involving another array in memory? If so, write and test the code for doing it. If not, use an additional array and test. Consider these cases:
Case 1. v = (6.3, 4.2, 9.3, 6.7, 7.8, 2.4, 3.8, 9.7),
p = (2, 3, 8, 7, 1, 4, 6, 5)
Case 2. v = (0.7, 0.6, 0.1, 0.3, 0.2, 0.5, 0.4),
p = (3, 5, 4, 7, 6, 2, 1)
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.