Docsity

Combinatorial Problems: Permutations, Variations, and Combinations, Exercises of Data Structures and Algorithms

Toggle sidebar
bg1
Page 1 of 3
Lab: Combinatorial Problems
1. Permutations without Repetitions
Given a set of elements, find all permutations without repetitions.
Examples
Input Output
A B C A B C
A C B
B A C
B C A
C B A
C A B
2. Permutations with Repetitions
Given a multi-set of elements, find all permutations.
Examples
Input Output
A B B A B B
B A B
B B A
3. Variations without Repetitions
Given a set of elements, find all variations of k elements without repetitions.
Examples
Input Output
A B C
2
A B
A C
B A
B C
C A
C B
pf3

Partial preview of the text

Download Combinatorial Problems: Permutations, Variations, and Combinations and more Exercises Data Structures and Algorithms in PDF only on Docsity!

Lab: Combinatorial Problems

1. Permutations without Repetitions

Given a set of elements, find all permutations without repetitions.

Examples

Input Output A B C A B C A C B B A C B C A C B A C A B

2. Permutations with Repetitions

Given a multi-set of elements, find all permutations.

Examples

Input Output A B B A B B B A B B B A

3. Variations without Repetitions

Given a set of elements, find all variations of k elements without repetitions.

Examples

Input Output A B C 2

A B

A C

B A

B C

C A

C B

4. Variations with Repetition

Given a set of elements, find all variations of k elements with repetitions.

Examples

Input Output A B C 2

A A

A B

A C

B A

B B

B C

C A

C B

C C

5. Combinations without Repetition

Given a set of elements, generate all combinations of k elements without repetition.

Examples

Input Output A B C 2

A B

A C

B C

6. Combinations with Repetition

Given a set of elements, generate all combinations of k elements with repetition.

Examples

Input Output A B C 2

A A

A B

A C

B B

B C

C C