Question: Write up a Java method using recursion that reorders an integer array in such a way that all the even values comes before the odd

Write up a Java method using recursion that reorders an integer array in such a way that all the even values comes before the odd values. output should be 8 6 2 4 4 4 4 3 5 5 3 7 1 9

Here is the code to start, fill in the missing part

 

public class MyClass {      static void organize(int[] data, int low, int high) {  //code here   // Hint: one way is to code similar to binary search and use the         // low and high        //code here               }      static void organize(int[] data) {//helper function          organize(data, 0, data.length - 1);      }      public static void main(String args[]) {        int[] data = {1,2,3,3,4,4,4,4,5,5,6,7,8,9};          organize(data);        for (int i : data) {              // accessing each element of array              System.out.print(i + " ");          }      }  }

 

2. 

Given the tree bellow 3 5 9 20) 20 8 (12) (30) 

 

3. Given the following code 

146 10 what is the preorder? (11) (21)(31) 


Given the tree bellow 3 5 9 20) 20 8 (12) (30) 146 10 what is the preorder? (11) (21)(31)

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!