Q4

vector<String> prefix;
prefix[0]=NULL;
prefixCount =1;
for (int i=0;i<n;i++)
  for (int j=0;j<n;j++)
    for (int k=0; k<prefixCount;k++)
    {
         if (visited[i][j]) continue;
         visited[i][j] = true;
         String s=prefix[k]+a[i][j];
         if (isWord(s) { printWord(s); prefix[k]=s; continue;}
         else if isPrefix(s) prefix[prefixCount++] = s;
         else removePrefix(prefix[k], prefixCount);
         prefix[prefixCount++] = String(a[i][j];
     }
Best Regards
Ashish Goel
"Think positive and find fuel in failure"
+919985813081
+919966006652


On Wed, Jul 4, 2012 at 4:13 PM, Ashish Goel <[email protected]> wrote:

> 1. inverted hasp map
> 2. not clear
> 3. VLR, how do you identify end of L and start of R, question incomplete
> 4. One problem: consider
>
> .......
> a b...
> c d...
> .......
>
> if ab is a prefix, can aba be another prefix, i would assume so. But if
> that is true, i am not sure if this program will come to an end.
> vector<String> prefix;
> prefix[0]=NULL;
> prefixCount =1;
> for (int i=0;i<n;i++)
>   for (int j=0;j<n;j++)
>     for (int k=0; k<prefixCount;k++)
>     {
>          String s=prefix[k]+a[i][j];
>          if (isWord(s) { printWord(s); prefix[k]=s; continue;}
>          else if isPrefix(s) prefix[prefixCount++] = s;
>          else removePrefix(prefix[k], prefixCount);
>          prefix[prefixCount++] = String(a[i][j];
>      }
> Best Regards
> Ashish Goel
> "Think positive and find fuel in failure"
> +919985813081
> +919966006652
>
>
>
> On Wed, Jul 4, 2012 at 12:22 PM, Decipher <[email protected]> wrote:
>
>> Find the next higher number in set of permutations of a given number
>
>
>

-- 
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