@durgesh,
step:-
1) sort the array
2) remove the smallest and largest element from arary. keep the smallest
elemnt in seperate queue(result)
3) repeat the above untill the array is empty or it contains only it
contains only one element
4) put the last element also in the queue (result)

for 2,3,5,,8,,10, the queue will  have 2,3,5 in this order right?
for A<-----1------>B<-------5------->C<------3----->D<-----2----->E
this algo gives 1,2,3,5,5 since you are just taking the 1st half of the
sorted array. am i wrong?

eg:-for ur example
sorted array wl be 2,3,5,,8,,10 result=empty
new sorted array=3,5,8 result=2
new sorted array=5 result 2,5 //acccording to your algo, 3 should be
inserted in result queue not 5
as it contains only 1 element so result=2,5,3

On Thu, Jul 7, 2011 at 11:22 PM, durgesh kumar <durgesh1...@gmail.com>wrote:

>
> @oppilas:- yes U r right... i simply mistyped it.......I think evrythng
> else is ok.
>
>
> thanks Durgesh
>
>  --
> 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.
>

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