Oh I didn't read the question properly, Thanks for pointing out... On Sat, May 28, 2011 at 10:28 PM, immanuel kingston < [email protected]> wrote:
> @Ankit, The input should be 2 sorted arrays > > Thanks, > Immanuel > > On Sun, May 29, 2011 at 10:48 AM, ankit sambyal <[email protected]>wrote: > >> @sravanreddy: it won't work. Try 3,91,9 and 90,1,8,2,5 . correct >> me if i m wrong. >> >> Thanks, >> Ankit Sambyal >> >> On Sat, May 28, 2011 at 9:16 PM, ross <[email protected]> wrote: >> >>> @sravanreddy: >>> Hey, Nice Solution :) cool! >>> >>> On May 29, 7:44 am, sravanreddy001 <[email protected]> wrote: >>> > Maintain a pointer A_end = m-1; >>> > doing a comparision something similar to merge sort >>> > >>> > int i=0;j=0; >>> > while (i< m){ >>> > if (a[i] < b[j]) >>> > i++; >>> > else{ >>> > swap(a[A_end],b[j]) >>> > A_end --; >>> > j++; >>> > } >>> > >>> > } >>> > >>> > This runs in O(m) time and no extra space, also the sort order is not >>> > guarenteed. >>> >>> -- >>> 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. >> > > -- > 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.
