Question: Given two arrays, a real array v = ( v 1 , v 2 , dots, v n ) and an integer permutation array p

Given two arrays, a real array v=(v1,v2,dots,vn) and an integer permutation array p=(p1,p2,dots,pn) of integers 1,2,dots,n, can we form a new permuted array v=(vp1,vp2,dots,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.
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)
 Given two arrays, a real array v=(v1,v2,dots,vn) and an integer permutation

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!