The elements of the array are taken as input. **The array is first sorted in ascending order (using bubble sort) and then the even and odd elements are separated into two separate arrays**.

```
INPUT: Array elements
OUTPUT: the sorted arrays of odd and even elements separately
PROCESS:
Step 1: [taking the input]
Read n [number of elements]
For i=0 to n-1 repeat
Read a[i]
[end of ‘for’ loop]
Step 2: [separating the odd and even elements]
/*Sort the array ‘a’ using any sorting technique*/
Set o<-0
Set e<-0
For i=0 to n-1 repeat
If a[i] mod 2=0 then
Set even[e]<-a[i]
Set e<-e+1
else
Set odd[o]<-a[i]
Set o<-o+1
[End of ‘if’]
[End of ‘for’ loop]
[printing the arrays]
For i=0 to e-1 repeat
Print even[i]
[End of ‘for’ loop]
For i=0 to o-1 repeat
Print odd[i]
[End of ‘for’ loop]
Step 3: Stop.
```

Related

- Find Maximum and Minimum from an array
- Kth Largest and Smallest Element
- 2nd largest element from the array
- Find how many negative numbers are present in the array
- The elements of the one array are copied to another array.
- Delete element from any position in array
- Frequency of each element in the Array
- Find out the unique elements from the Array
- Finds odd and even elements from the array and stored in two separate arrays
- Counts the number of odd and even elements separately from the array
- Reverses the elements of an Array
- Merge two Array and stored in the third Array
- Rotated the Array at left
- Rotated the Array right
- Sort number of strings in an array
- Check one given element of an array present more than n/2 times or not.
- Sum of the elements of an Array is calculated using a pointer
- The union and intersection between the two given arrays