white_coder's blog

By white_coder, 12 years ago, In English

I am trying to generate all possible unique permutation by using bitmask , code:(http://ideone.com/2SZyGh) .but how can i handle the repeated value.

EX. for the input 112 output should be(112,121,211).But my code give 6 permutation with 3 same value.

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
12 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

you may want to consider using next_permutation. (it's inside algorithm.h)

»
12 years ago, hide # |
 
Vote: I like it -9 Vote: I do not like it