Skip to content

Instantly share code, notes, and snippets.

View ranafge's full-sized avatar
🏠
Working from home

Samsul Islam ranafge

🏠
Working from home
View GitHub Profile
@tamim
tamim / allsubsets.py
Last active December 17, 2018 14:29
Python code to generate all subsets of a set.
"""
Generate all subsets of a set using recursion
"""
def subsets1(S):
if S == []:
return [[]]
result = [[]]
n = len(S)
visited = [False] * n