I think we can use KMP string matching algorithm.

On Fri, Oct 8, 2010 at 6:40 PM, shashank jain <[email protected]>wrote:

> there are 2 unsorted array we have to want a third array in sorted
> form in mininmum time complexicity
>
> answer can like be this merge the two array in 3rd array then sort the
> array
>
>                          or
> sort the individual array and then merge
>
> if feel first one is better
>
> can any one can help
>
>
> On 10/8/10, snehal jain <[email protected]> wrote:
> > @ligerdave
> > m nt getting ur algo..can u explain with an example
> >
> >
> > On 10/8/10, snehal jain <[email protected]> wrote:
> >>
> >> @neeraj
> >> ur worst case complexity will be O(mn)
> >>
> >>
> >>  On 10/8/10, snehal jain <[email protected]> wrote:
> >>>
> >>> @tech
> >>> the ouput will be abhgrtsghgrthswert as no suffix of 1st matches with
> >>> prefix of 2nd
> >>>
> >>>
> >>>  On 10/7/10, ligerdave <[email protected]> wrote:
> >>>>
> >>>> use pointer. shift to left if one more leading char has been found.
> >>>> any unmatched char resets the pointer to first char
> >>>>
> >>>> once you went through the entire list(first one), the pointer on the
> >>>> second list tells you where to concatenate
> >>>>
> >>>> that gives you O(n) where n is the length of first list
> >>>>
> >>>> On Oct 7, 3:52 am, snehal jain <[email protected]> wrote:
> >>>> > There are two linked list, both containing a character in each node.
> >>>> >
> >>>> > If one linked list contain characters  o x e n c and second contain
> >>>> > characters e n c a r t a then the final linked list should contain o
> x
> >>>> > e n c a r t a    i.e. if the end of one list is same as the start of
> >>>> > second then those characters should come only once.
> >>>> >
> >>>> > can we do it in O(n+m) where n and m are the length of list. both
> are
> >>>> > singly link list.
> >>>>
> >>>> --
> >>>> 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]<algogeeks%[email protected]>
> <algogeeks%[email protected]<algogeeks%[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]<algogeeks%[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]<algogeeks%[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.

Reply via email to