![]() |
Need programming help
I would be more than happy to help you. I love to program, and I know a lot about C++. I dont think there are any built in functions that will do that for you, but there are some that can help you do this. How long can the string be?
|
Say a limit of 25 characters?
I know that that would be practically impossible - it works out to 25! combinations - but I'm taking that as the theoretical maximum I'd want. |
We can use each letter only the number of times it appeared in the original string. If that is the case, then the number of combinations reduces to 25! (= 25x24x23x22....x1), or even less. If we are allowed to use the same element an arbitrary number of times, then it becomes 25^25.
|
The problem solved in ML; this solution is nicer.
This is programmed using a very functionel strategy, somewhat different from the PHP one used above. It seemed so much nicer that I tried translating it to php afterwards, but I ended up with a PHP program larger and uglier than the PHP program above. Code: Code:
val chars = ["a", "b", "c"]; fun gen (a::arest) bs res = (gen (arest@bs) [] (a::res))@(gen arest (a::bs) res) | gen [] [] res = [res] | gen [] bs res = []; gen chars [] []; |
*Smacks head*
Damn the incorrect terminology! |
WTF is ML?
|
Originally posted by LordShiva
WTF is ML? you didn't have to take the "History of dead programming languages" course? |
It's hard to argue against the awesome efficiency of functional programming in cases like this...
|
All times are GMT +1. The time now is 06:37 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0 PL2