Yup...I think thats the way to go...modify heap sort...'ignoring the odd
childs' for ascending and ignoring the even child for decending.
If i am wrong in this then quick sort has to be the solution.
On Sat, May 28, 2011 at 8:44 AM, subramania jeeva <subramaniaje...@gmail.com
> wrote:

> I hope merge sort is not an inplace sorting.. It'll take extra space (in
> function merge) and since it uses recursion it'll also take stack space..
> I think this sol will work.
>   1. partition the array by holding the even elements on first space(n/2 or
> n/2-1 depends on odd sized and even sized array) of array and odd elements
> in last n/2 space of array.
>   2. Do heapsort by using both min heap and maxheap  by having 0 and
> (sizeof even elements) as root of heap.
>   3. Heap don't use extra space and time complexity is O(nlgn).
>
>
>
>
>
>
>
>
>
>
>
>
>
> Cheers
>           ~ Jeeva ~
>
>
>
>  --
> 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.
>



-- 
Saurabh Singh
B.Tech (Computer Science)
MNNIT ALLAHABAD

-- 
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