@amol I was trying to put forward the point that the o/p need not be sorted.If you check the difference between time of my and payal's message it was a case of race condition. Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com
On Sun, Mar 25, 2012 at 6:54 AM, Gene <[email protected]> wrote: > This problem isn't carefully defined. If you have 3,4,2 then 2 is the > first value smaller and of higher index than both 3 and 4. So which > to swap with? > > On Mar 24, 10:01 am, Navin Kumar <[email protected]> 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 post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
