Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to print all permutations of a string

void permutation(string s)
{
    sort(s.begin(),s.end());
	do{
		cout << s << " ";
	}
    while(next_permutation(s.begin(),s.end()); // std::next_permutation
    
    cout << endl;
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #print #permutations #string
ADD COMMENT
Topic
Name
4+6 =