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 == "" ) {
                cout<<oth<<endl;
                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.

Reply via email to