• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

generatinf pattern strings

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can any one tell me how can i generate pattern strings of the following form:

"a.* .*a";
"a.* .*b";
"a.* .*c";
"a.* .*d";
"a.* .*e";
"a.* .*f";
"aa"
"ab"
"ac"
"ad"
"ae"
"af"
similarly for alphabets b,c,d...upto z

thanks for support
 
best scout
Posts: 1294
Scala IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Fundupuneet,

I guess you try to find all permutations of a string consisting of all letters from the alphabet, right?

Here is an example in Java. I've not tested it but I'm pretty sure it works as described. Unfortunately the the shortest form to generate all permutations of a given string is mostly a recursive algorithm and therefore harder to understand. I hope you can figure out what it does at least to some degree.

Perhaps you can just google for more information about permutations in general if you'd like to know more about it.

Marco
 
Puneet N Vyas
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i didn't get that program,let me describe the problem more properly:
these are pattern strings
String patternStr= "a.* .*a";
String patternStr= "a.* .*b";
and so on as i mentioned above,i have to do also for each patternstring,a corresponding candidate like for pattern string(a regular expression)a.* .*a,i have candidate a a,now whenever that pattern is encountered in the input string ,i have to increment the count for the candidate that corresponds for the pattern string,how can i generate such correspondence,also how can i generate pattern strings ,here is the code i wrote,tell me how can do that job..
 
Puneet N Vyas
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i forgot the sample.txt contents:here are it's contents
a abc ac d cf
ad c bc ae
ef ab df c b
e g af c b c
 
author
Posts: 23956
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

... and so on as i mentioned above,i have to do also for each patternstring,a corresponding candidate like for pattern string(a regular expression)a.* .*a,i have candidate a a,now whenever that pattern is encountered in the input string ,i have to increment the count for the candidate that corresponds for the pattern string,how can i generate such correspondence,also how can i generate pattern strings , ...



Can you elaborate exactly what you want? This description doesn't make much sense.

Henry
 
I'm doing laundry! Look how clean this tiny ad is:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic