Question: undefined In the following program, the code for function separate_odd_even is missing. This function should shuffle the numbers in array a such that all odd

undefined In the following program, the code for function separate_odd_even is missing.undefined

In the following program, the code for function separate_odd_even is missing. This function should shuffle the numbers in array a such that all odd numbers appear before even numbers while keeping the orders among odd numbers and orders among even numbers. Examples: Example 1: Input: a=[5,7,6,3,2,1), n=6 Output: a=[5,7,3,1,6,2] Explanation: odd numbers 5,7,3,1 are put infront of even numbers 6,2. Please note that the orders among odd numbers and orders among even numbers are unchanged. If your output changes this order, it will be INCORRECT. For example a=[5,7,1,3,6,2] will be an incorrect answer because 5,7,1,3 is a change of order from the original order of 5,7,3,1. Example 2: Input: [1,2,3,4,5,6,7,8,9,10] Output: (1,3,5,7,9,2,4,6,8,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!