Hi all,

Sort all elements in odd indices of an array in ascending order and
even indices in descending order.
Finally, rearrange so that all even indexed elements come first.

eg:

input – 7 2 6 4 8 3 1

even indexed : 7 6 8 1 => sort 8 7 6 1
odd indexed: 2 4 3 => sort 2 3 4

output – 8 7 6 1 2 3 4

What could be the best algo to solve it?
Is it possible to arrive at the output using only O(1) extra space?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to