No, best way is to use a trie, or a suffix-trie. Look here:

> http://phpir.com/tries-and-wildcards

On Sep 13, 12:32 pm, anuj maurice <anuj.maur...@gmail.com> wrote:
> you will have to use the concept of edit distance ..
> google for edit distance and you may find too many good articles on it.
> "Levenshtein distance" is one such algorithm for measuring the amount of
> difference between two sequences [edit distance]
>
> On Mon, Sep 13, 2010 at 2:55 PM, Praveen Baskar 
> <praveen200...@gmail.com>wrote:
>
>
>
> > i think that we have to generate substrings from the given string such that
> > the similarity is above 50%
> > for eg.
> > word ="foo"
> > we have to generate the strings which must be greater than half of the
> > given string length
> > {"fo","oo"} (in this case)
>
> > after this operation we have the following string set {"foo","fo","oo"}
>
> > then we can do    select* from product where name like '%foo%'....select*
> > from product where name like '%fo%'..... select* from product where name
> > like '%oo%'
>
> > please do correct me if i am wrong
> >  On Mon, Sep 13, 2010 at 1:01 PM, SVIX 
> > <saivivekh.swaminat...@gmail.com>wrote:
>
> >> select * from product
> >> where
> >>     name like '%foo%'
> >>     and len(name) <=6;
>
> >> btw, how do u define similarity? i'm guessing it wouldn't be this
> >> simple...
>
> >> On Sep 12, 5:12 am, Snoopy Me <thesnoop...@gmail.com> wrote:
> >> > You are given the amazon.com database which consists of names of
> >> > millions of products. When a user enters a search query for particular
> >> > object with the keyword say "foo" , output all the products which have
> >> > names having 50% or more similarity with the given keyword ie "foo"
>
> >> > Write the most efficient algorithm for the same.
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Algorithm Geeks" group.
> >> To post to this group, send email to algoge...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/algogeeks?hl=en.
>
> > --
> > By B. Praveen
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algoge...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.
>
> --
> regards ,
> Anuj Maurice

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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.

Reply via email to