In fact this solution was suggested (without code) in the original
discussion.

It's O(n^2).

You're only re-ordering a constant number (4) of elements in each
recursive pass, and each pass requires O(n) time to execute.  You also
need to assume your compiler will remove the tail recursion.
Otherwise it will also require O(n) space, which misses the whole
point of the problem.

On Aug 15, 12:29 pm, Debajyoti Sarma <sarma.debajy...@gmail.com>
wrote:
> Array of 2n length is given {a1,a2,a3,...,an,b1,b2,b3,...,bn}
> we have to make the array like as {a1,b1,a2,b2,a3,b3,...,an,bn}
> without using extra buffer space.
> here a solution i came up withhttp://codepad.org/ub5Ie4sI
> I know this was discussed before .
> But i want to know the time complexity of the code i have given(i m
> confused)

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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