• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

generatinf pattern strings  RSS feed

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • 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
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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: 23832
140
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!