@swathi i think your algo won't work try out for the following cases 1. 2,3,5,7,8,10 2. 2,3,5,6,9,11
On Thu, Jul 7, 2011 at 10:59 PM, oppilas . <jatka.oppimi...@gmail.com>wrote: > > 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) >> >> >> eg:-for ur example >> sorted array wl be 2,3,5,,8,,10 result=empty >> new sorted array=3,5,8 result=2 >> > After this step, according to your second step, you will insert 3 in queue > first. Why have u inserted 5 here? > >> new sorted array=5 result 2,5 >> as it contains only 1 element so result=2,5,3 >> >> >> >> >> >> >> -- >> 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. > -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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.