For a large list of words,
"At each location, look 
for the character before/after that character in the word on opposite 
sides of the initial location, and continue from there"

Is it like:
frequency count of 'a' is smallest

'a' is in 2 words "available" and "alpha"

shall we check for 'v' near 'a'; if found then look for the complete word
OR
look for 'v' and 'i' on both sides of 'a'; if found then search for 
remaining characters in both directions
OR
look for 'l' and 'b' on both sides of 'a'; if found then search for 
remaining characters in both directions
OR
look for 'l' 'a'; if found then search for remaining characters in that 
direction
OR
look for 'h' 'a'; if found then search for remaining characters in that 
direction

Is this what we should be doing?

On Saturday, 15 September 2012 01:43:14 UTC+5:30, Don wrote:
>
> I had to do something like this with a large list of words to search 
> for. If you're just looking for one word, look for the first letter, 
> and when you find it, look at adjacent locations for the second 
> letter. If found, continue in that direction matching letters until 
> you either match the whole word or don't. 
>
> But for a big list of words to search for, it was faster to do 
> something like this: 
> Build a frequency count for each character, along with a list of 
> ordered pairs indicating where that character is located. Then, to 
> look for a word, find the character with the smallest frequency count 
> and step through the list for that character. At each location, look 
> for the character before/after that character in the word on opposite 
> sides of the initial location, and continue from there. 
>
> Don 
>
> On Sep 14, 2:47 pm, Arun Kindra <reserve4placem...@gmail.com> wrote: 
> > *You have given any n*n matrix in which characters are stored and you 
> have 
> > to search that a given word is present or not.(words can be 
> horizontally, 
> > vertically, diagonally)* 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/tKJcCEYJsjAJ.
To post to this group, send email to algogeeks@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