Nice solution Akshay.
Here is my small attempt!
[image: Inline image 1]
#Pralay
On Mon, May 7, 2012 at 1:03 AM, Akshay Rastogi akr...@gmail.com wrote:
private static void swap(char[] str, int i,int j) {
char temp = str[i];
str[i] = str[j];
str[j] = temp;
}
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
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);
http://www.geeksforgeeks.org/archives/767 just look into url
-Original Message-
From: algogeeks@googlegroups.com [mailto:algogeeks@googlegroups.com] On
Behalf Of Sairam Ravu
Sent: Monday, May 07, 2012 12:59 PM
To: algogeeks@googlegroups.com
Subject: Re: [algogeeks] Permutations
I have written a code which gives all permutations of a string. I have
assumed that all the characters in a given string are distinct.
The main idea is as follows
-if suppose abc is given first
my base case is to form permutations of two characters
so I will have ab and ba
Now, I will just
Given a string of length 5 (example abcde), write a program to print all
the possible combinations OF LENGTH 3.
In this case : abc, abd, abe, acd, ace, ade, bcd, bce, bde, cde
Can someone provide a working code?
--
Nikhil Gupta
Senior Co-ordinator, Publicity
CSI, NSIT Students' Branch
NSIT,
One more thread is running parallel on the same topic
Please refer :
http://comments.gmane.org/gmane.comp.programming.algogeeks/17279
On Wed, Jul 27, 2011 at 7:39 AM, Nikhil Gupta nikhilgupta2...@gmail.comwrote:
Given a string of length 5 (example abcde), write a program to print