Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
algorithm problem in sofware project
we're in a middle of a software project, and we got stuck somewhere. in this part we should do something like this:
1. get a rule that looks like !0-4?2-4@@ that defines a password structure, and a dictionary filename
2. break the rule into parts, !0-4 ?2-4 @ @
each part represents an other rule- let's say !0-4 means the first part of the password should contain between 0 and 4 english chars, ?2-4 means that the second part should contain between 2 and 4 general chars (including %,^ etc), and @ means that we receive a word from a dictionary, so let's say the dictionary has the words "abc" and "asd", a good password (that fits in the rule) is alpha%&abcasd, because we can divide it into alph a%& abc asd and it fits the rule.
3. we get an int n (and here's the hard part), we want to generate the n'th password, so that for different n's we'll get different results. in other words, there is a 1 to 1 correspondence between the n's and the passwords generated by the rule.
the problem is that we can get rules like !0-2!0-2, and then the password aa can be generated in 3 different ways- (aa)(), ()(aa), (a)(a). this ofc gets even more complex for longer and more complex rules.
i'd be glad if someone could help us out here...we're really stuck :
0 · ·