sort an array such that one half of the array has even numbers in ascending order and the other half
- by nd81
Design an algorithm with min time and space
here is my solution -
assume a array of N elements with 32 bit integers
use a bit array to set the appropriate bits
the array is sorted now
assign even numbers to the first half of the array in ascending order
assign odd numbers to the second half of the array in descending order
any better solution ?