DiscussWorldIssues - Socio-Economic Religion and Political Uncensored Debate

DiscussWorldIssues - Socio-Economic Religion and Political Uncensored Debate (http://www.discussworldissues.com/forums/index.php)
-   General Discussion (http://www.discussworldissues.com/forums/forumdisplay.php?f=27)
-   -   Need programming help (http://www.discussworldissues.com/forums/showthread.php?t=122251)

womberte 12-25-2006 10:03 AM

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?

adunnyByday 12-25-2006 11:31 AM

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.

loginptsa 12-25-2006 11:38 AM

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.

Hsmrcahr 12-25-2006 11:56 AM

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    []      [];

IodinkBoilk 12-25-2006 01:40 PM

*Smacks head*

Damn the incorrect terminology!

BundEnhamma 12-25-2006 05:47 PM

WTF is ML?

Salliter 12-25-2006 06:17 PM

Originally posted by LordShiva
WTF is ML? you didn't have to take the "History of dead programming languages" course?

Polopolop 12-25-2006 06:46 PM

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