![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Jan 2006
Posts: 55
Rep Power: 3
![]() |
randStr
i just got done making a program thats goal is to take a string and generate all possible ways to re-arrange the letters in it. here is the source:
c Syntax (Toggle Plain Text)
and the output is this if i use 'anthony' for the input: aathony anahony antaony anthany anthoay anthona anthony annhony antnony anthnny anthony anthonn atthony anthony anttony anthtny anthoty anthont ahthony anhhony anthony anthhny anthohy anthonh aothony anohony antoony anthony anthooy anthono anthony annhony antnony anthnny anthony anthonn aythony anyhony antyony anthyny anthoyy anthony aathony anahony antaony anthany anthoay anthona anthony annhony antnony anthnny anthony anthonn atthony anthony anttony anthtny anthoty anthont ahthony anhhony anthony anthhny anthohy anthonh aothony anohony antoony anthony anthooy anthono anthony annhony antnony anthnny anthony anthonn aythony anyhony antyony anthyny anthoyy anthony aathony anahony antaony anthany anthoay anthona anthony annhony antnony anthnny anthony anthonn atthony anthony anttony anthtny anthoty anthont ahthony anhhony anthony anthhny anthohy anthonh aothony anohony antoony anthony anthooy anthono anthony annhony antnony anthnny anthony anthonn aythony anyhony antyony anthyny anthoyy anthony aathony anahony antaony anthany anthoay anthona anthony annhony antnony anthnny anthony anthonn atthony anthony anttony anthtny anthoty anthont ahthony anhhony anthony anthhny anthohy anthonh aothony anohony antoony anthony anthooy anthono anthony annhony antnony anthnny anthony anthonn aythony anyhony antyony anthyny anthoyy anthony aathony anahony antaony anthany anthoay anthona anthony annhony antnony anthnny anthony anthonn atthony anthony anttony anthtny anthoty anthont ahthony anhhony anthony anthhny anthohy anthonh aothony anohony antoony anthony anthooy anthono anthony annhony antnony anthnny anthony anthonn aythony anyhony antyony anthyny anthoyy anthony aathony anahony antaony anthany anthoay anthona anthony annhony antnony anthnny anthony anthonn atthony anthony anttony anthtny anthoty anthont ahthony anhhony anthony anthhny anthohy anthonh aothony anohony antoony anthony anthooy anthono anthony annhony antnony anthnny anthony anthonn aythony anyhony antyony anthyny anthoyy anthony aathony anahony antaony anthany anthoay anthona anthony annhony antnony anthnny anthony anthonn atthony anthony anttony anthtny anthoty anthont ahthony anhhony anthony anthhny anthohy anthonh aothony anohony antoony anthony anthooy anthono anthony annhony antnony anthnny anthony anthonn aythony anyhony antyony anthyny anthoyy anthony and i was just wondering if this would be the correct output for the file? (meaning that all possibilities have been extinguished). if there is something wrong, please let me know. |
|
|
|
|
|
#2 |
|
Professional Programmer
![]() Join Date: Sep 2005
Posts: 419
Rep Power: 4
![]() |
>and i was just wondering if this would be the correct output for the file?
No. Look at the first and second strings: aathony anahony
__________________
Even if the voices aren't real, they have some pretty good ideas. |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Jan 2006
Posts: 55
Rep Power: 3
![]() |
hmmm..doesnt seem to be, but i think that i will look it up on google.
|
|
|
|
|
|
#4 |
|
Programmer
|
It can not be correct according to mathematics also as word 'anthony' has 7 chracters in it. If you create a cross product of these chracters then chracter a can be in 7 positions like 'anthony', 'nathony', 'ntahony', and so on.
so there are n(n-1)! ways to arrange these letter in different ways where n is nummber of chracters in a string. so (7)(6)(5)(4)(3)(2) = 5040 possible combinations
__________________
Iftikhar Ahmed Khan For doing an experiment on programmer's mood please visit http://uxisfyp1.brunel.ac.uk/cspgiak |
|
|
|
|
|
#5 | |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 770
Rep Power: 3
![]() |
Quote:
![]()
__________________
<insert disclaimer here> <insert shameless plug for Visual Studio here> |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|