This algorithm won't find the smallest subtext. Suppose the keywords
are A B and C and the text is A A B A C. The algorithm will report the
entire text as the subtext, but the correct answer is B A C.

Dave

On Feb 13, 3:46 am, arun <[EMAIL PROTECTED]> wrote:
> maintain a hash table with keys as the set of keywords and values as a
> boolean value initialized with false.
> initialize a counter count with 0
> let n be the total number of keywords.
> start comparing the words of the text with keywords.
> If word matches with keyword then
> {
> go to hash table and
>  if value is false make it true and increment count by 1.
> if value is true then do nothing
> once count becomes n.we have found the subtext.}
>
> else {
> go to next word of the text
>
> }
>
> On Feb 13, 5:16 am, conundrum <[EMAIL PROTECTED]> wrote:
>
>
>
> > Given a text and a set of keywords, is there a linear time algorithm
> > to find the smallest subtext containing all the keywords (at least
> > once) ?- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to