Yes Dave, you are right.
I hope algorithm below will work.

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.
word = 1st word of the text
while(  word )
{
stack1.pushe( word )
  if word matches with keyword then
   {
    go to hash table and
      if value is false then
         make value true and increment count by 1.
      if value is true then
         do nothing
    if( count == n ) then
      break from while loop
   word = next word in text
}
if(count == n)
{
count = 0
make all the values in hash table false
while( stack1 not empty or count != n)
{
tmp_word = stack1.pop()
queue1.enque( tmp_word )
  if word matches with keyword then
   {
    go to hash table and
      if value is false then
         make value true and increment count by 1.
      if value is true then
         do nothing
    }
 }
print elements of the queue1 by poping them out.
} else { text doesnot contain subtext }
    text does not have subtext
--~--~---------~--~----~------------~-------~--~----~
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