perhaps its this quoted line...

" permu(c,i+1,j); "  ---->"permu(c,i+1,n)

On Thu, Jul 26, 2012 at 9:37 PM, teja bala <pawanjalsa.t...@gmail.com>wrote:

> // plz anyone tell me whats wrong in this code
> //o/p should print all possible permutations of string.....
>
> class swap
> {
>  char ab[]={'a','b','c'};
>  public static void main(String[] args)
> {
> swap c=new swap();
>  permu(c.ab,0,3);
> }
> public static void permu(char c[],int i,int n)
>  {
> System.out.print(i);int j;
> if(i==n){ for( char ch:c)System.out.print(ch);}
>  else
> {
> for(j=i;j<n;j++)
>  {
> swaps(c[i],c[j]);
> permu(c,i+1,j);
>  swaps(c[i],c[j]);
> }
>  }
> }
> public static void swaps (char x,char y)
>  {
> char temp1=x;
> x=y;
>  y=temp1;
> }
> }
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to