RK DSA Studio

Subsets

Enumerate every selection of distinct input elements by including or excluding each one.

Remember: Each element: include or exclude.

Example: [1,2] → [], [1], [2], [1,2].

Time: O(n × 2ⁿ). Auxiliary space: O(n).

Formula: Each element: exclude or include → 2ⁿ subsets

Up to 5 distinct integers. The active call path is shown; solutions are copied at leaves. Complexity includes copying output; stored solutions use O(n × 2ⁿ) space.

Complexities describe the underlying algorithm; tutorial snapshots and rendering can use additional resources.

The interactive workspace loads here when JavaScript is available. You can still browse the learning notes and links above without it.