Date post: | 14-Oct-2015 |
Category: |
Documents |
Upload: | geetikajain |
View: | 501 times |
Download: | 0 times |
of 21
5/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-strin
2/27/2014 Write a C program to print all permutations of a given string | GeeksforGeeks
http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
GeeksforGeeks
A computer scienceportal for geeks
GeeksQu
Login
Home
Algorithms
DS
GATE
Interview Corner
Q&A
C
C++
Java
Books
Contribute
Ask a Q
About
Array
Bit Magic
C/C++Articles
GFacts
Linked List
MCQ
Misc
Output
String
Tree
Graph
Write a C program to print all permutations of a given string
A permutation, also called an arrangement number or order, is a rearrangement of the elements of an
ordered list S into a one-to-one correspondence with S itself. A string of length n has n! permutation.
Source: Mathword(http://mathworld.wolfram.com/Permutation.html)
Below are the permutations of string ABC.
ABC, ACB, BAC, BCA, CAB, CBA
http://mathworld.wolfram.com/Permutation.htmlhttp://www.geeksforgeeks.org/category/tree/http://www.geeksforgeeks.org/category/program-output/http://www.geeksforgeeks.org/category/c-programs/http://www.geeksforgeeks.org/category/multiple-choice-question/http://www.geeksforgeeks.org/category/linked-list/http://www.geeksforgeeks.org/category/articles/http://www.geeksforgeeks.org/category/c-puzzles/http://www.geeksforgeeks.org/category/bit-magic/http://www.geeksforgeeks.org/category/c-arrays/http://www.geeksforgeeks.org/about/http://www.geeksforgeeks.org/contribute/ask-a-question/http://www.geeksforgeeks.org/contribute/http://www.geeksforgeeks.org/java/http://www.geeksforgeeks.org/http://www.geeksforgeeks.org/wp-login.phphttp://mathworld.wolfram.com/Permutation.htmlhttp://www.geeksforgeeks.org/category/graph/http://www.geeksforgeeks.org/category/tree/http://www.geeksforgeeks.org/category/c-strings/http://www.geeksforgeeks.org/category/program-output/http://www.geeksforgeeks.org/category/c-programs/http://www.geeksforgeeks.org/category/multiple-choice-question/http://www.geeksforgeeks.org/category/linked-list/http://www.geeksforgeeks.org/category/gfact/http://www.geeksforgeeks.org/category/articles/http://www.geeksforgeeks.org/category/c-puzzles/http://www.geeksforgeeks.org/category/bit-magic/http://www.geeksforgeeks.org/category/c-arrays/http://www.geeksforgeeks.org/about/http://www.geeksforgeeks.org/contribute/ask-a-question/http://www.geeksforgeeks.org/contribute/http://www.geeksforgeeks.org/books/http://www.geeksforgeeks.org/java/http://www.geeksforgeeks.org/c-plus-plus/http://www.geeksforgeeks.org/c/http://www.geeksforgeeks.org/forums/http://www.geeksforgeeks.org/about/interview-corner/http://www.geeksforgeeks.org/gate-corner/http://www.geeksforgeeks.org/data-structures/http://www.geeksforgeeks.org/fundamentals-of-algorithms/http://www.geeksforgeeks.org/http://www.geeksforgeeks.org/wp-login.phphttp://geeksquiz.com/http://www.geeksforgeeks.org/5/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-strin
2/27/2014 Write a C program to print all permutations of a given string | GeeksforGeeks
http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
Here is a solution using backtracking.
# include
/* Function to swap values at two pointers */
void swap (char *x, char *y){
char temp;
temp = *x;
*x = *y;
*y = temp;
}
/* Function to print permutations of string
This function takes three parameters:
1. String
2. Starting index of the string
3. Ending index of the string. */void permute(char *a, int i, int n)
{
int j;
if (i == n)
printf("%s\n", a);
else
{
for (j = i; j
5/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-strin
2/27/2014 Write a C program to print all permutations of a given string | GeeksforGeeks
http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
}
Output:
ABC
ACB
BAC
BCA
CBA
CAB
Algorithm Paradigm: Backtracking
Time Complexity: O(n*n!)
Please write comments if you find the above codes/algorithms incorrect, or find other ways to solve the same
problem.
Related Tpoics:
Recursively remove all adjacent duplicates
Find the first non-repeating character from a stream of characters
Dynamic Programming | Set 33 (Find if a string is interleaved of two other strings)
Remove b and ac from a given stringDynamic Programming | Set 29 (Longest Common Substring)
Write your own atoi()
String matching where one string contains wildcard characters
Count words in a given string
97Like Tweet 1 8
Writing code in comment?Please use ideone.comand share the link here.
222 Comments
http://ideone.com/http://www.geeksforgeeks.org/count-words-in-a-given-string/http://www.geeksforgeeks.org/wildcard-character-matching/http://www.geeksforgeeks.org/write-your-own-atoi/http://www.geeksforgeeks.org/longest-common-substring/http://www.geeksforgeeks.org/remove-a-and-bc-from-a-given-string/http://www.geeksforgeeks.org/check-whether-a-given-string-is-an-interleaving-of-two-other-given-strings-set-2/http://www.geeksforgeeks.org/find-first-non-repeating-character-stream-characters/http://www.geeksforgeeks.org/recursively-remove-adjacent-duplicates-given-string/http://twitter.com/search?q=http%3A%2F%2Fwww.geeksforgeeks.org%2Fwrite-a-c-program-to-print-all-permutations-of-a-given-string%2Fhttps://twitter.com/intent/tweet?original_referer=http%3A%2F%2Fwww.geeksforgeeks.org%2Fwrite-a-c-program-to-print-all-permutations-of-a-given-string%2F&text=Write%20a%20C%20program%20to%20print%20all%20permutations%20of%20a%20given%20string&tw_p=tweetbutton&url=http%3A%2F%2Fwww.geeksforgeeks.org%2Fwrite-a-c-program-to-print-all-permutations-of-a-given-string%2F&via=jakerutter5/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-strin
2/27/2014 Write a C program to print all permutations of a given string | GeeksforGeeks
http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
Kai
The solution doesn't work if the string contains duplicate charaters like 'AAB' , obviously thiscase should be handled by the permutation algo.
Pratham
I wrote the code for variable length string but the program gives segmentation fault.
#include
void swap(char *i,char *j)
{
char t;t=*i;
*i=*j;
*j=t;
}
void perm(char *str,int i,int n)
{
int j;
if(i==n)
{printf("%s",str);
}
else
{
for(j=i;j
5/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-strin
2/27/2014 Write a C program to print all permutations of a given string | GeeksforGeeks
http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
int n;
printf("Enter the string");
scanf("%s",string);
n=strlen(string);
perm(string,0,n);
return 0;
}
please tell me where i went wrong
Javed
in the main() funcion you need to pass 1 less than strlen(string) i.e the maximum actu
index in the string i.e. n-1 to the function perm().
Pratham
I tried it javed but still it is giving me the same segmentation fault .
I am using dev C++ ide
SHANTANU AGRAWAL
http://ideone.com/WPCW48
Ankit
Can someone tell me that when I use char *temp in the swap function why doesn't my progra
work?
sonu
When length of string is unknown ,i.e. Char array can be of any size , Pass by referen
is used .
Vignesh A
The code works fine with out Back Tracking.. Please explain the logic
void permute(char *a, int i, int n)
{
int j;
if (i == n)
printf("%s\n", a);
else
http://disqus.com/disqus_q8kx5JdCXE/http://disqus.com/disqus_ztaSsOPhR4/http://disqus.com/disqus_tZd5hq7nNm/http://disqus.com/shantanuagrawal/http://disqus.com/disqus_iVDS5NAHlZ/http://disqus.com/disqus_lT8LybToML/http://ideone.com/WPCW485/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-strin
2/27/2014 Write a C program to print all permutations of a given string | GeeksforGeeks
http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
{
for (j = i; j
5/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-strin
2/27/2014 Write a C program to print all permutations of a given string | GeeksforGeeks
http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
if(a+i == a+j && i != j) continue;
// rest of the code as given
}
mragrid
What if i want the algorithm to stop if it reaches a limit ? for example if we have 3628800 (10!
permutations and i want it to stop when we have generated 1000 permutations ? and what timcomplexity we will have that way ?
Jingguo Yao
Lexicographic permutation generation algorithm handles duplicated characters. See page 31
of The Art of Computer Programming, Volume 4A, Chapter 7.2.1.2.
importsys
MIN_INT = -sys.maxint - 1deflexicographic_order_generation(A):
A[0:0] = [MIN_INT]
A.sort()
n = len(A) - 1
whileTrue:
print("".join([str(x) forx inA[1:]]))
j = n - 1
whileA[j] >= A[j + 1]:
j -= 1 ifj == 0:
return
l = n
whileA[j] >= A[l]:
l -= 1
A[j], A[l] = A[l], A[j]
suffix = A[j+1:]
suffix.reverse()
A = A[:(j + 1)] + suffix
A = [1, 2, 3]
lexicographic_order_generation(A)
A = list("AABAAC")
lexicographic_order_generation(A)
http://disqus.com/jingguoyao/http://disqus.com/mragrid/5/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-strin
2/27/2014 Write a C program to print all permutations of a given string | GeeksforGeeks
http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
mathsmaths
thanks
DevilGeek
Just like a tower of Hanoi.
atiq
//Repeatation will not harm my code....like AABA ... will give result with no repeatation
http://ideone.com/acjCxb
Happy coding
Sriharsha g.r.v well done and thanq
Sriharsha g.r.v
it will not work for repeated character strings i.e "abaaa" it prints many repeated strings
Gaurav Ramesh
you can change the swap condition .. to only swap when character at i and j are notsame..
so your condition inside for will look like:
for(..){
if(a+i == a+j && i != j) continue;
// rest of the code as given..
}
akshita
will you help me in understanding this code plz
Gaurav Ramesh
Hi Akshita,
If you've understood the main code, the change I've suggested is just t
http://disqus.com/gauravramesh/http://disqus.com/disqus_xj0o057g8H/http://disqus.com/gauravramesh/http://disqus.com/sriharshagrv/http://disqus.com/sriharshagrv/http://disqus.com/atiqwhiz/http://ideone.com/acjCxb5/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-strin
2/27/2014 Write a C program to print all permutations of a given string | GeeksforGeeks
http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
prevent swapping of the letters when both letters at i and j are same !
thus avoiding the repeated permutations..
derek
not correct,
for example 'aabb'
Gaurav Ramesh
Hey Derek, I don't see why this shouldn't work for your input ! when i a
are both pointing to a or b, they shouldn't be swapped and just continu
Guest
should be
if((*(char *)(a+i) == *(char *)(a+j)) && (i != j)) continue;
Sameer
http://codingrecipies.blogspot...
DarkProtocol
Without recursion is greatly appreciated!!! Thanks in advance.
GuestPost
//check this
//http://www.cplusplus.com/refer...
Puzzled
Can someone explain the time complexity
Neha Garg
i am unable to understand this code ..plz explain it step wise
Guy
the idea is that for every N length string we can calculate the permutation of that string
http://disqus.com/disqus_iz9DUQjcv2/http://disqus.com/gauravramesh/http://www.cplusplus.com/reference/algorithm/next_permutation/http://codingrecipies.blogspot.in/2013/10/permutation-of-string.html5/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-string
2/27/2014 Write a C program to print all permutations of a given string | GeeksforGeeks
http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
the permutations of the rest of the string and then the permutations of the string starts
with the second letter + all the permutations of the rest of the string and so on until we
reach the strings which starts with the last letter of the string + all the permutations of
the rest of the string .
following that logic the recursion tree grows.
the swap simply moves to the start the letter we wanted to start with and is used to
make all the changes "in place" thus not to waste extra space.(if space is not a problem then this could also be done by creating an array of strings
and concatenating the first letter to the already generated string each time instead of t
swap).
Bharath G M
http://www.youtube.com/watch?v...Good one..
all izz well
iam not able to understand this program ....
can anyone trace and explian it plz ..........
Bharath G M
http://www.youtube.com/watch?v..... Good one
Nhan
Time Complexity is O(n!), not O(n*n!)
First for-loop is n times, second for-loop in the first recursive call is (n-1) times and so on.
Hence O(n!), or more tightly _Theta_(n!) as both lower and upper bounds are (n!)
Silent
what is the need of backtrack step here?? answer is still correct without this step..
Marsha Donna
the need 4 backtracking is to always work with the original string..in the second iterati
after a and b are swapped the string becomes bac..when the function is recurively
called..the permutation of bac keepin b fixed are Bac and Bca...if we leave the string a
bca..in the next iteration when we have to swap a and c(in original string abc) to form
cba it would not be possible correctly unless we revert Bca back to bac...then it would
go back change bac to the original string abc after which a and c are swapped to cba
http://disqus.com/marshadonna/http://disqus.com/bharathgm/http://disqus.com/allizzwell/http://disqus.com/bharathgm/http://www.youtube.com/watch?v=MQcwxQK2DPAhttp://www.youtube.com/watch?v=MQcwxQK2DPA5/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-string
2/27/2014 Write a C program to print all permutations of a given string | GeeksforGeeks
http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
the next iteration...see the figure above
Pranjal
Its correct for the ABC case --- Try it with 4 characters and you will see the importanc
of backtracking !!!
Guest
// TreeToDLL.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include
usingnamespacestd;
structNode
{
intdata; Node *left;
Node *right;
};
classTree
{
staticintl;
staticintflip;
staticintleafdepth;
staticNode * prev;staticNode * previous;
staticintcount;
public:
Node *head;
intmaxdepth;
Tree()
{
head = NULL;
maxdepth = 0;
}
voidInorder(Node *node)
{
if(node)
{
Inorder(node->left);
std::cout
5/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-string
2/27/2014 Write a C program to print all permutations of a given string | GeeksforGeeks
http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
}
voidTreetoDLL(Node *node)
{
if(node)
{
TreetoDLL(node->left);
if(previous)
{
previous->right = node;
node->left = previous;
}
if(count == 0)
{
head = node;
count = count + 1;
}
previous = node;
TreetoDLL(node->right);
}
}
voidPrintDLL()
{
Node *tmp = head;
while(tmp)
{
std::coutright;
}
}
voidInsertNode(Node *node,intdata)
{
Node * tmp = node;
if(head == NULL)
{
head = newNode;
head->data = data;
head->left = NULL;
head->right = NULL;
return;
}
elseif(tmp)
{
prev = tmp;
if data > tm ->data
5/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-string
2/27/2014 Write a C program to print all permutations of a given string | GeeksforGeeks
http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
{
l=0;
tmp = tmp -> right;
InsertNode(tmp,data);
}
else
{
l=1;
InsertNode(tmp->left,data);
}
}
if(l == 1)
{
prev->left = newNode;
prev->left->data = data;
prev->left->left = NULL;
prev->left->right = NULL;
l = -1;
return;
}
elseif(l == 0)
{
prev->right = newNode;
prev->right->data = data;
prev->right->left = NULL;
prev->right->right = NULL;
l = -1;
return;
}
}
};
intTree::l =0;
intTree::flip =0;
intTree::leafdepth =-1;
intTree::count = 0;
Node * Tree::prev = NULL;
Node * Tree::previous = NULL;
intmain(intargc, char* argv[])
{
Tree t;
t.InsertNode(t.head,10);
t.InsertNode(t.head,7);
t.InsertNode(t.head,13);
5/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-string
2/27/2014 Write a C program to print all permutations of a given string | GeeksforGeeks
http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
t.InsertNode(t.head,5);
t.InsertNode(t.head,9);
t.InsertNode(t.head,12);
t.InsertNode(t.head,15);
t.InsertNode(t.head,3);
t.InsertNode(t.head,6);
t.InsertNode(t.head,8);
t.InsertNode(t.head,11);t.InsertNode(t.head,1);
t.InsertNode(t.head,4);
t.InsertNode(t.head,2);
t.TreetoDLL(t.head);
t.PrintDLL();
return0;
}
raghvendra
#include
#include
#include
using namespace std;
char str[100];
void permutation(int n)
{
char x;
if(n
5/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-string
2/27/2014 Write a C program to print all permutations of a given string | GeeksforGeeks
http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
}
}
intmain()
{
cin>>str;
cout
5/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-string
2/27/2014 Write a C program to print all permutations of a given string | GeeksforGeeks
http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
}
Indra Kumar Gurjar
/* withour recursion */.
#include
#includestruct node
{
char *str;
int curr;
struct node* next;.
};
typedef struct node node;.
node * new_node(char *str, int curr, node* next).
{
char *temp;.
temp=(char*)malloc(strlen(str)+1);
node* ptr=(node*)malloc(sizeof(node));.
ptr->str=temp;
strcpy(ptr->str, str);
Indra Kumar Gurjar
/* withour recursion */.
#include
#include
struct node
{
char *str;
int curr;
struct node* next;.
};
typedef struct node node;.
node * new_node(char *str, int curr, node* next).
{
char *temp;.
temp=(char*)malloc(strlen(str)+1);
node* ptr=(node*)malloc(sizeof(node));.
-> =
5/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-string
2/27/2014 Write a C program to print all permutations of a given string | GeeksforGeeks
http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
strcpy(ptr->str, str);
Irfanali117
publicclasspermute {
staticvoidpermute(intlevel, String permuted,
booleanused[], String original) {
intlength = original.length();
if(level == length) {
System.out.println(permuted);
} else{
for(inti = 0; i < length; i++) {
if(!used[i]) {
used[i] = true;
permute(level + 1, permuted + original.charAt(i),
used, original);
used[i] = false;
}
Raj Kishor
[sourcecode language="C++"]
//permutation of a string
#include
#include
using namespace std;
void permute(string ,string , int);
int main()
{
string str="",dats;
coutdats;
cout
5/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-string
2/27/2014 Write a C program to print all permutations of a given string | GeeksforGeeks
http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
Load more comments
void permute(string str,string dats, int j)
Kamal Zuhairi Zamli
is this vb...no c version of the code ?
vishal
//In C#....
public static void permutation(string strPrefix, string str)
{
int n = str.Length;
if(n == 1)
Console.WriteLine(strPrefix + str);
for (int i = 0; i < str.Length; i++)
{
string prefix = strPrefix + str.Substring(i, 1);
permutation(prefix, str.Substring(0,i) + str.Substring(i+1,n-i-1));
}
}
rajashekar007
What if there are duplicates in the string?
https://disqus.com/websites/?utm_source=geeksforgeeks&utm_medium=Disqus-Footerhttp://disqus.com/5/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-string
2/27/2014 Write a C program to print all permutations of a given string | GeeksforGeeks
http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
Interview Experiences
Advanced Data Structures
Dynamic Programming
Greedy Algorithms
Backtracking
Pattern Searching
Divide & Conquer
Mathematical Algorithms
RecursionGeometric Algorithms
Popular Posts
All permutations of a given string
Memory Layout of C ProgramsUnderstanding extern keyword in C
Median of two sorted arrays
Tree traversal without recursion and without stack!
Structure Member Alignment, Padding and Data Packing
Intersection point of two Linked Lists
Lowest Common Ancestor in a BST.
Check if a binary tree is BST or not
Sorted Linked List to Balanced BST
http://www.geeksforgeeks.org/sorted-linked-list-to-balanced-bst/http://www.geeksforgeeks.org/a-program-to-check-if-a-binary-tree-is-bst-or-not/http://www.geeksforgeeks.org/lowest-common-ancestor-in-a-binary-search-tree/http://www.geeksforgeeks.org/write-a-function-to-get-the-intersection-point-of-two-linked-lists/http://www.geeksforgeeks.org/structure-member-alignment-padding-and-data-packing/http://www.geeksforgeeks.org/inorder-tree-traversal-without-recursion-and-without-stack/http://www.geeksforgeeks.org/median-of-two-sorted-arrays/http://www.geeksforgeeks.org/understanding-extern-keyword-in-c/http://www.geeksforgeeks.org/memory-layout-of-c-program/http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/http://www.geeksforgeeks.org/tag/geometric-algorithms/http://www.geeksforgeeks.org/tag/recursionhttp://www.geeksforgeeks.org/tag/MathematicalAlgohttp://www.geeksforgeeks.org/tag/divide-and-conquerhttp://www.geeksforgeeks.org/tag/pattern-searchinghttp://www.geeksforgeeks.org/tag/backtrackinghttp://www.geeksforgeeks.org/tag/Greedy-Algorithm/http://www.geeksforgeeks.org/tag/dynamic-programminghttp://www.geeksforgeeks.org/tag/advance-data-structureshttp://www.geeksforgeeks.org/tag/interview-experience5/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-string
2/27/2014 Write a C program to print all permutations of a given string | GeeksforGeeks
http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
655 Subscribe
Recent Comments
gagan
for question i think answer should be D as An...
Database Management Systems | Set 2 5 minutes ago
Debabrata Bardhan
#include #define BUFSIZE 5 struct...
Pairwise swap elements of a given linked list by changing links 15 minutes ago
http://www.googleadservices.com/pagead/aclk?sa=L&ai=C3H6bEB4QU6i3OsbRmQWKnoDQC4LintgGgtLigI8BwI23ARABILKPtCFQhrqph_j_____AWDlgoCArA6gAY6YmtwDyAEDqQKoMsV2MkpRPqgDAcgDwQSqBLgBT9BeN0sjP8_AIH-fkWW1gzAWxLpSKiiJnZFMLuEHoW9vlLQkUOw61BR4JdRbl2hyJLSRvSzTX_zZpZEU7ruF0SBfVn9NskyLELP2P3RDeUtmWRosfz1evt_49hnGnIf8pEU8vkjJUludcdX-j5jZt2vnQt3UeaKN0pDFCawewq3rGRA2k4Mq9jPBrsZuMX4e9-pFZvAfF5RXp0qUD5brHW0tdIWiCaaB5tYK-V1FgzBDD8t7IMmQ14gGAaAGA4AH2uflIw&num=1&cid=5Ggdq3_Yz8HZIf2lUkmdTbmC&sig=AOD64_3AM2qDGNDynoo8dkbnjQuP7ffwqA&client=ca-pub-9465609616171866&adurl=http://d.adx.io/clicks%3Fxb%3D35BBw318%26xd%3D30%26utm_campaign%3DGoogle-MainAcc-LK-HomeBrand-NoCat-Display-Contextual%26xu%3Dhttp%253a%252f%252fwww.lenskart.com%252f%26utm_source%3Dgoogle%26utm_term%3Ddiscount%2520coupons%2520lenskart%26xm%3D%26xs%3Dwww.geeksforgeeks.org%26xtg%3D%26xnw%3Dd%26utm_content%3D38518894178%26xp%3Dnone%26utm_medium%3Dcpc&nm=1http://www.geeksforgeeks.org/pairwise-swap-elements-of-a-given-linked-list-by-changing-links/#comment-1264037588http://www.geeksforgeeks.org/pairwise-swap-elements-of-a-given-linked-list-by-changing-links/http://www.geeksforgeeks.org/database-management-system-set-2/#comment-1264043290http://www.geeksforgeeks.org/database-management-system-set-2/http://feeds.feedburner.com/Geeksforgeekshttp://feeds.feedburner.com/Geeksforgeeks5/24/2018 Write a C Program to Print All Permutations of a Given String _ GeeksforGeeks - s...
http:///reader/full/write-a-c-program-to-print-all-permutations-of-a-given-string
C++ Find String
String String
String Java
http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-9465609616171866&output=html&h=90&slotname=2606115235&adk=1866548233&w=160&lmt=1392748228&flash=12.0.0&url=http%3A%2F%2Fwww.geeksforgeeks.org%2Fwrite-a-c-program-to-print-all-permutations-of-a-given-string%2F&dt=1393527448548&bpp=587&bdt=1066&shv=r20140220&cbv=r20140226&saldr=aa&prev_fmts=160x90_0ads_al&prev_slotnames=2606115235%2C2606115235&correlator=1393527447698&frm=20&ga_vid=549716430.1390626463&ga_sid=1393527363&ga_hid=1975743041&ga_fc=1&u_tz=-480&u_his=1&u_java=1&u_h=768&u_w=1366&u_ah=728&u_aw=1366&u_cd=24&u_nplug=13&u_nmime=61&dff=helvetica&dfs=12&adx=872&ady=2553&biw=1351&bih=667&oid=3&ref=http%3A%2F%2Fwww.geeksforgeeks.org%2Ffundamentals-of-algorithms%2F&rx=0&eae=0&vis=2&fu=0&ifi=6&xpc=PbUecvRqmi&p=http%3A//www.geeksforgeeks.org&dtd=603&rl_rc=true&adsense_enabled=true&ad_type=text&ui=rc:0&oe=utf8&height=90&width=160&format=fpkc_al_lp&kw_type=radlink&rt=ChBTEB4SAAKXIQqmv87LAAvEEgtTdHJpbmcgSmF2YRoIUsw0a9T1SKMoATADUhMIjaTf9oruvAIVJ5emCh3jUAAi&hl=en&kw0=C%2B%2B+Find+String&kw1=String+String&kw2=String+Java&okw=String+Javahttp://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-9465609616171866&output=html&h=90&slotname=2606115235&adk=1866548233&w=160&lmt=1392748228&flash=12.0.0&url=http%3A%2F%2Fwww.geeksforgeeks.org%2Fwrite-a-c-program-to-print-all-permutations-of-a-given-string%2F&dt=1393527448548&bpp=587&bdt=1066&shv=r20140220&cbv=r20140226&saldr=aa&prev_fmts=160x90_0ads_al&prev_slotnames=2606115235%2C2606115235&correlator=1393527447698&frm=20&ga_vid=549716430.1390626463&ga_sid=1393527363&ga_hid=1975743041&ga_fc=1&u_tz=-480&u_his=1&u_java=1&u_h=768&u_w=1366&u_ah=728&u_aw=1366&u_cd=24&u_nplug=13&u_nmime=61&dff=helvetica&dfs=12&adx=872&ady=2553&biw=1351&bih=667&oid=3&ref=http%3A%2F%2Fwww.geeksforgeeks.org%2Ffundamentals-of-algorithms%2F&rx=0&eae=0&vis=2&fu=0&ifi=6&xpc=PbUecvRqmi&p=http%3A//www.geeksforgeeks.org&dtd=603&rl_rc=true&adsense_enabled=true&ad_type=text&ui=rc:0&oe=utf8&height=90&width=160&format=fpkc_al_lp&kw_type=radlink&rt=ChBTEB4SAAKXHAqmv87LAAvEEg1TdHJpbmcgU3RyaW5nGgg3OT6vcFpdOCgBMANSEwiNpN_2iu68AhUnl6YKHeNQACI&hl=en&kw0=C%2B%2B+Find+String&kw1=String+String&kw2=String+Java&okw=String+Stringhttp://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-9465609616171866&output=html&h=90&slotname=2606115235&adk=1866548233&w=160&lmt=1392748228&flash=12.0.0&url=http%3A%2F%2Fwww.geeksforgeeks.org%2Fwrite-a-c-program-to-print-all-permutations-of-a-given-string%2F&dt=1393527448548&bpp=587&bdt=1066&shv=r20140220&cbv=r20140226&saldr=aa&prev_fmts=160x90_0ads_al&prev_slotnames=2606115235%2C2606115235&correlator=1393527447698&frm=20&ga_vid=549716430.1390626463&ga_sid=1393527363&ga_hid=1975743041&ga_fc=1&u_tz=-480&u_his=1&u_java=1&u_h=768&u_w=1366&u_ah=728&u_aw=1366&u_cd=24&u_nplug=13&u_nmime=61&dff=helvetica&dfs=12&adx=872&ady=2553&biw=1351&bih=667&oid=3&ref=http%3A%2F%2Fwww.geeksforgeeks.org%2Ffundamentals-of-algorithms%2F&rx=0&eae=0&vis=2&fu=0&ifi=6&xpc=PbUecvRqmi&p=http%3A//www.geeksforgeeks.org&dtd=603&rl_rc=true&adsense_enabled=true&ad_type=text&ui=rc:0&oe=utf8&height=90&width=160&format=fpkc_al_lp&kw_type=radlink&rt=ChBTEB4SAAKXCwqmv87LAAvEEg9DKysgRmluZCBTdHJpbmcaCIp7cw0rJq43KAEwA1ITCI2k3_aK7rwCFSeXpgod41AAIg&hl=en&kw0=C%2B%2B+Find+String&kw1=String+String&kw2=String+Java&okw=C%2B%2B+Find+Stringhttps://www.google.com/url?ct=abg&q=https://www.google.com/adsense/support/bin/request.py%3Fcontact%3Dabg_afc%26url%3Dhttp://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/%26gl%3DIN%26hl%3Den%26client%3Dca-pub-9465609616171866&usg=AFQjCNHDgvUCcdwW6hx-KkNXRwWcpYbgaw