It can be done in O(n) time and O(1) space.
Logic:
1. Start at i = 0.
2. Take first half of the array and exchange elements at i=2 to n/2
with n/2+1
3. n = n/2, start = n/2+1
4. Repeat steps 2 and 3 until n becomes 0.

On Jan 9, 7:41 am, Decipher <[email protected]> wrote:
> No its a single array . You have to convert first array into second in
> O(n) time and O(1) space .

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

Reply via email to