title: Generating permutation of string without duplicates
body: <p>I have writing a general program to generate permutation of string but removing the duplicate cases . For this I am using memorization by using .</p>
  
  <pre><code>void permute(char *a,int i, int n,set&lt;char*&gt; s)
  {
      if(i==n)
      {
          if(s.find(a)==s.end()){
              cout&lt;&lt;"no dublicate"&lt;&lt;endl;
              cout&lt;&lt;a&lt;&lt;endl;
              s.insert(a)
          }
      }
      else{
          for(int j=i;j&lt;n;j++)
          {
              swap(a[i],a[j]);
              permute(a,i+1,n,s);
              swap(a[i],a[j]);
          }
      }
  }
  
  int main()
  {
      char a[]="aba";
      set &lt;char*&gt; s;
      permute(a,0,3,s);
      return 0;
  }
  </code></pre>
  
  <p>But the result is not as desired. It prints all the permutation. Can anyone help me in figuring out the problem.</p>