Jump to content

How do i find the combination of a 7 letter word?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
mr_skyflakes21

mr_skyflakes21

    Learning Programmer

  • Members
  • PipPipPip
  • 54 posts
How can i find the combination of a word.
for example: abc,acb,bac,bca,cab,cba

i only know this because i analyze it, but how about 7 letter word?or 8 maybe?
Because as the letter increases, the combination increases also exponentially.

is there any technique to do it?

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Technically, what you are talking about is permutations. Do you want to list them or count them (two completely different issues)?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
mr_skyflakes21

mr_skyflakes21

    Learning Programmer

  • Members
  • PipPipPip
  • 54 posts
I need to know their arrangement.^_^.
Coz i only know the equation where i can find all the possible permutation without repeating.

The actual arrangement is what i am looking for.

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
First issue: are you dealing with words with repeating letters or not?
Second issue: are you storing the results in a file or something? 7 letters = up to 5040 words. 8 letters = up to 40320 words!
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
mr_skyflakes21

mr_skyflakes21

    Learning Programmer

  • Members
  • PipPipPip
  • 54 posts
Im just aiming for 7 letter word. 5040 is too big for the memory..hihihi.
No Repitition.

#6
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
no repetition = 5040 different permutations.
You will probably want to look at doing something like this:
given string "abdslef", start at the right and find the first character pair that is not in reverse order (in this case, "ef") and reverse them, then list the characters after the first reversed character in sorted order. For example:
"abdslef"
"abdslfe"
"absefls" - s moves forward, sort "dlfe"
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog