2 Replies Latest reply on Feb 13, 2013 9:26 PM by dadams07

    Can anyone explain me concept of Recursion?

      Hi All,
      Im struggling for understanding the concept of Recursion from past many days . can anyone please explain me how it works with the below example.
      public class Permutation {
           * @param args the command line arguments
           public static String name;
          public static void main(String[] args)throws Exception {
          DataInputStream dis=new DataInputStream(System.in);
          permutation("", name);
          private static  void permutation(String prefix,String str){
              int n=str.length();
                  for (int i = 0; i < str.length(); i++) {
                   permutation(prefix+str.charAt(i),str.substring(0, i)+str.substring(i+1, n) );
      Thanks and Regards,
      Mahesh M

      Edited by: Mahesh M on 13 Feb, 2013 7:31 AM

      Edited by: EJP on 13/02/2013 20:25: revised your bizarre formatting to use {noformat}
      {noformat} tags: please use them.