combinations algorithm

Posted by mysterious jean on Stack Overflow See other posts from Stack Overflow or by mysterious jean
Published on 2010-03-24T07:59:35Z Indexed on 2010/03/24 8:13 UTC
Read the original article Hit count: 486

Filed under:
|
|

I want to make simple sorting algorithm.

given the input "abcde", I would like the output below. could you tell me the algorithm for that?

arr[0] = "a"
arr[1] = "ab"
arr[2] = "ac"
arr[3] = "ad"
arr[4] = "ae"
arr[5] = "abc"
arr[6] = "abd"
arr[7] = "abe"
...
arr[n] = "abcde"

arr[n+1] = "b"
arr[n+2] = "bc"
arr[n+3] = "bd"
arr[n+4] = "be"
arr[n+5] = "bcd"
arr[n+5] = "bce"
arr[n+5] = "bde"
...
arr[n+m] = "bcde"
...
...

© Stack Overflow or respective owner

Related posts about c

    Related posts about c++