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.








you may want to consider using next_permutation. (it's inside algorithm.h)
code
what this function actually do?
I am sure it is for debug purposes only.
it's ASSERT. If condition is not true program fails by Runtime Error. If my program recieves Runtime Error, i can replace body of this function by while(!bb) ;;;; Now if program recieves TLE it's assertion failure, otherwise it is real RE.