private static void swap(char[] str, int i,int j) {
        char temp = str[i];
        str[i] = str[j];
        str[j] = temp;
    }

    private static void permute (char[] str, int strCurrIndex) {
        if (strCurrIndex == (str.length-1)) {
            System.out.println(str);
            return;
        }
        for (int i = strCurrIndex; i < str.length; i++) {
            swap(str, i, strCurrIndex);
            permute(str, (strCurrIndex+1));
            swap(str, i, strCurrIndex);
        }
        return;
    }

    public static void main (String[] args) {
        char[] str = {'a','b','c'};
        permute(str, 0);
    }

On Mon, May 7, 2012 at 12:59 PM, Sairam Ravu <[email protected]> wrote:

> Somebody please help me!!
>
>
> --
> With love and regards,
> Sairam Ravu
> I M.Tech(CS)
> Sri Sathya Sai Institute of Higher Learning
> "To live life, you must think it, measure it, experiment with it,
> dance it, paint it, draw it, and calculate it"
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
AKSHAY RASTOGI
BE(Hons) CS
BITS PILANI , Pilani

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

Reply via email to