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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started