Re: [algogeeks] string permutation

2011-10-01 Thread Prakash D
if the string is like abcdef
then they will be numbered like 012345 and now we represent them in base 5
numbering and also in sorted order
the next permutation is
012354
012435
012453
012534
012543
013245
and so on..



On Sat, Oct 1, 2011 at 4:11 PM, rahul sharma rahul23111...@gmail.comwrote:

 guys plz xplain logic behind the string permutation.n if we have
 duplicates that should program display the duplicates or notnyone plz
 tell the logic/code for this.

 --
 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.



Re: [algogeeks] string permutation

2011-10-01 Thread rahul sharma
i have searched the archives.any give me algorithm with example...it
would be great help..thnx in advance

On Sun, Oct 2, 2011 at 2:57 AM, Prakash D cegprak...@gmail.com wrote:

 if the string is like abcdef
 then they will be numbered like 012345 and now we represent them in base 5
 numbering and also in sorted order
 the next permutation is
 012354
 012435
 012453
 012534
 012543
 013245
 and so on..



 On Sat, Oct 1, 2011 at 4:11 PM, rahul sharma rahul23111...@gmail.comwrote:

 guys plz xplain logic behind the string permutation.n if we have
 duplicates that should program display the duplicates or notnyone plz
 tell the logic/code for this.

 --
 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.


-- 
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.



Re: [algogeeks] string permutation

2011-10-01 Thread Thayumanavar S
i have searched the archives.any give me algorithm with
example...it would be great help..thnx in advance


#include iostream
#include string
#include stdio.h
using namespace std;
void
permute(string inp, string oth)
{
if ( inp ==  ) {
coutothendl;
return;
}
for ( int i = 0; i  inp.length(); i++ ) {
permute(inp.substr(0,i)+inp.substr(i+1),oth+inp.substr(i,1));
}
}
int
main(int argc,char** argv)
{
permute(abcd,);
return 0;
}

( you can draw recursion tree and how it works).


thx,

thayumanavar s.

-- 
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.