-
Notifications
You must be signed in to change notification settings - Fork 1
/
example.js
44 lines (34 loc) · 989 Bytes
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Eaxmple
const n = 4;
const k = [1, 2, 3];
const your_combinations = new YourCombinations(k);
let _permutations, _combinations;
_permutations = your_combinations.permutations(n, true);
while (true) {
const item = _permutations.next();
if (item.done) break;
console.log(item.value);
}
console.log("=====================");
_combinations = your_combinations.your_combinations(n, true);
while (true) {
const item = _combinations.next();
if (item.done) break;
console.log(item.value);
}
console.log("=====================");
_permutations = your_combinations.permutations(2, false);
while (true) {
const item = _permutations.next();
if (item.done) break;
console.log(item.value);
}
console.log("=====================");
_combinations = your_combinations.your_combinations(2, false);
while (true) {
const item = _combinations.next();
if (item.done) break;
console.log(item.value);
}
console.log("=====================");
console.log([...your_combinations.powerSet(k)]);