6. Assignment 10
WAP to print all possible combinations of given string.
Input: Read the String.
7. Assignment 10
WAP to print all possible combinations of given string.
Input: Read the String.
Output:
8. Assignment 10
WAP to print all possible combinations of given string.
Input: Read the String.
Output: Print all the possible combinations of given string.
10. Assignment 10
Example’s:
Input: Enter the string: ABC
Output: All possible combinations of the given string:
• ABC
• ACB
• BAC
• BCA
• CBA
• CAB
15. Assignment 10
Example’s:
A B C
Input string
Swap A with A
A B C B A C
Swap A with B
C B A
Swap A with C
A is fixed
16. Assignment 10
Example’s:
A B C
Input string
Swap A with A
A B C B A C
Swap A with B
C B A
Swap A with C
A is fixed B is fixed
17. Assignment 10
Example’s:
A B C
Input string
Swap A with A
A B C B A C
Swap A with B
C B A
Swap A with C
A is fixed B is fixed C is fixed
18. Assignment 10
Example’s:
A B C
Input string
Swap A with A
A B C B A C
Swap A with B
C B A
Swap A with C
A is fixed B is fixed C is fixed
A B C
Swap B with B
19. Assignment 10
Example’s:
A B C
Input string
Swap A with A
A B C B A C
Swap A with B
C B A
Swap A with C
A is fixed B is fixed C is fixed
A B C
Swap B with B
A C B
Swap B with C
20. Assignment 10
Example’s:
A B C
Input string
Swap A with A
A B C B A C
Swap A with B
C B A
Swap A with C
A is fixed B is fixed C is fixed
A B C
Swap B with B
A C B
Swap B with C
AB is fixed
21. Assignment 10
Example’s:
A B C
Input string
Swap A with A
A B C B A C
Swap A with B
C B A
Swap A with C
A is fixed B is fixed C is fixed
A B C
Swap B with B
A C B
Swap B with C
AB is fixed AC is fixed
22. Assignment 10
Example’s:
A B C
Input string
Swap A with A
A B C B A C
Swap A with B
C B A
Swap A with C
A is fixed B is fixed C is fixed
A B C
Swap B with B
A C B
Swap B with C
AB is fixed AC is fixed
B A C
Swap A with A
23. Assignment 10
Example’s:
A B C
Input string
Swap A with A
A B C B A C
Swap A with B
C B A
Swap A with C
A is fixed B is fixed C is fixed
A B C
Swap B with B
A C B
Swap B with C
AB is fixed AC is fixed
B A C
Swap A with A
B C A
Swap A with C
24. Assignment 10
Example’s:
A B C
Input string
Swap A with A
A B C B A C
Swap A with B
C B A
Swap A with C
A is fixed B is fixed C is fixed
A B C
Swap B with B
A C B
Swap B with C
AB is fixed AC is fixed
B A C
Swap A with A
B C A
Swap A with C
BA is fixed
25. Assignment 10
Example’s:
A B C
Input string
Swap A with A
A B C B A C
Swap A with B
C B A
Swap A with C
A is fixed B is fixed C is fixed
A B C
Swap B with B
A C B
Swap B with C
AB is fixed AC is fixed
B A C
Swap A with A
B C A
Swap A with C
BA is fixed BC is fixed
26. Assignment 10
Example’s:
A B C
Input string
Swap A with A
A B C B A C
Swap A with B
C B A
Swap A with C
A is fixed B is fixed C is fixed
A B C
Swap B with B
A C B
Swap B with C
AB is fixed AC is fixed
B A C
Swap A with A
B C A
Swap A with C
BA is fixed BC is fixed
C B A
Swap B with B
27. Assignment 10
Example’s:
A B C
Input string
Swap A with A
A B C B A C
Swap A with B
C B A
Swap A with C
A is fixed B is fixed C is fixed
A B C
Swap B with B
A C B
Swap B with C
AB is fixed AC is fixed
B A C
Swap A with A
B C A
Swap A with C
BA is fixed BC is fixed
C B A
Swap B with B
C A B
Swap B with A
28. Assignment 10
Example’s:
A B C
Input string
Swap A with A
A B C B A C
Swap A with B
C B A
Swap A with C
A is fixed B is fixed C is fixed
A B C
Swap B with B
A C B
Swap B with C
AB is fixed AC is fixed
B A C
Swap A with A
B C A
Swap A with C
BA is fixed BC is fixed
C B A
Swap B with B
C A B
Swap B with A
CB is fixed
29. Assignment 10
Example’s:
A B C
Input string
A B C B A C C B A
A B C A C B B A C B C A C B A C A B
Swap A with A Swap A with B Swap A with C
Swap B with B Swap B with C Swap A with A Swap A with C Swap B with B Swap B with A
A is fixed B is fixed C is fixed
AB is fixed AC is fixed BA is fixed BC is fixed CB is fixed CA is fixed