@saurabh - couldn't get what are you trying to say.. @payal - yes...the o/p need not to be sorted.
Brute force will give O(n^2) solution. -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad <http://gplus.to/amolsharma99> <http://twitter.com/amolsharma99><http://in.linkedin.com/pub/amol-sharma/21/79b/507><http://www.simplyamol.blogspot.com/> On Sun, Mar 25, 2012 at 1:13 AM, payal gupta <gpt.pa...@gmail.com> wrote: > the o/p for the array { 1 ,6 ,8 ,3 ,5, 4, 2} is: > > > 2 6 8 3 5 4 1 > 1 3 8 6 5 4 2 > 1 3 6 8 5 4 2 > 1 3 6 5 8 4 2 > 1 3 6 5 4 8 2 > 1 3 6 5 4 2 8 > not necessarily the sorted array... > > > On Sun, Mar 25, 2012 at 1:04 AM, shady <sinv...@gmail.com> wrote: > >> what is the output for this ? >> { 1 ,6 ,8 ,3 ,5, 4, 2} >> >> On Sat, Mar 24, 2012 at 7:31 PM, Navin Kumar <navin.nit...@gmail.com>wrote: >> >>> Given an array of integers, for each index i, you have to swap the value >>> at i with the first value smaller than A[ i ] that comes after index i. >>> An efficient solution expected. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Algorithm Geeks" group. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msg/algogeeks/-/an6YzWV-2xsJ. >>> 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. >> > > -- > 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.