Question: 6 . Given an array of 2 n elements a 1 , a 2 , . . . an , b 1 , b 2

6. Given an array of 2n elements a1,a2,...an,b1,b2,.....,bn. We want to shuffle the array to get a1,b1,a2,b2,....an,bn without using any new array. Give an algorithm to solve the problem.
Use your algorithm to write a program to shuffle array
int a[10]={1,3,5,7,9,2,4,6,8,10} ; should become a[10]={1,2,3,4,5,6,7,8,9,10};

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!