Posts

Showing posts with the label odd even elements arrangement in array

Odd Even ISC Specimen 2023 Theory

Design a class OddEven to arrange two single dimensional arrays into one single dimensional array, such that the odd numbers from both the arrays are at the beginning followed by the even numbers. Example : Array 1: {2, 13, 6, 19, 26, 11, 4} Array 2: {7, 22, 4, 17, 12, 45} Arranged Array = {13, 19, 11, 7, 17, 45, 2, 6, 26, 4, 22, 4, 12} Some of the members of the class are given below: Class name : OddEven Data members/instance variables : a[]: to store integers in the array m: integer to store the size of the array Methods/Member functions : OddEven(int num): parameterized constructor to initialize the data member m = num void fillArray(): to enter integer elements in the array OddEven arrange(OddEven p, OddEven q): stores the odd numbers from both the parameterized object arrays followed by the even numbers from both the arrays and returns the object with the arranged array void display(): displays the elements of the arranged array Specify the class OddEven giving details of the co...