Question: Use recursion to solve the below: a)) Write a method when you pass it an array of integers, it splits the array into odd an

Use recursion to solve the below:

a)) Write a method when you pass it an array of integers, it splits the array into odd an even sections. It will put the odd numbers at the beginning of the array and the even numbers at the end of the array. The algorithm should work even if the array is all odd or all even. Example: If you input [1,2,3,4,5,6,7,8.9] The output would be: [1,3,5,7,9,2,4,6,8]

b)) Ask the user to read another integer which represents the size of the array to be read in. After you read the integer n, read that many integers and store them in an array, and call the second method and print the resulting array which is split into odd and even section.

pleae make sure u use only one recursion method to solve this problem

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!