aboutsummaryrefslogtreecommitdiffstats
path: root/csci4041/hw2prob2.py
blob: 39e533afba6ab95ec81202de201d26bea8f470a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Watch the value of K!!!
# - Jeremiah
def making_sets(n, k, e, s):
    if k == 0:
        print(s)
    else:
        for e_i in range(e, n + 1):
            s = set.union(s, {e_i})
            making_sets(n, k - 1, e_i + 1, s)
            s = set.difference(s, {e_i})

def make_sets(n, k):
    making_sets(n, k, 1, set())

make_sets(4,3)
print()
make_sets(6,1)