LOGO
General Discussion Undecided where to post - do it here.

Reply to Thread New Thread
Old 12-25-2006, 10:03 AM   #1
womberte

Join Date
Oct 2005
Posts
408
Senior Member
Default 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?
womberte is offline


Old 12-25-2006, 11:31 AM   #2
adunnyByday

Join Date
Oct 2005
Posts
519
Senior Member
Default
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.
adunnyByday is offline


Old 12-25-2006, 11:38 AM   #3
loginptsa

Join Date
Oct 2005
Posts
502
Senior Member
Default
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.
loginptsa is offline


Old 12-25-2006, 11:56 AM   #4
Hsmrcahr

Join Date
Oct 2005
Posts
429
Senior Member
Default
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    []       [];

Hsmrcahr is offline


Old 12-25-2006, 01:40 PM   #5
IodinkBoilk

Join Date
Oct 2005
Posts
453
Senior Member
Default
*Smacks head*

Damn the incorrect terminology!
IodinkBoilk is offline


Old 12-25-2006, 05:47 PM   #6
BundEnhamma

Join Date
Oct 2005
Posts
448
Senior Member
Default
WTF is ML?
BundEnhamma is offline


Old 12-25-2006, 06:17 PM   #7
Salliter

Join Date
Oct 2005
Posts
441
Senior Member
Default
Originally posted by LordShiva
WTF is ML? you didn't have to take the "History of dead programming languages" course?
Salliter is offline


Old 12-25-2006, 06:46 PM   #8
Polopolop

Join Date
Oct 2005
Posts
437
Senior Member
Default
It's hard to argue against the awesome efficiency of functional programming in cases like this...
Polopolop is offline



Reply to Thread New Thread

« Previous Thread | Next Thread »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

All times are GMT +1. The time now is 11:06 AM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 PL2
Design & Developed by Amodity.com
Copyright© Amodity