From 3baf88cf7539426f4c1e4f7afa992de31ffa9fc5 Mon Sep 17 00:00:00 2001 From: Oleksii Trekhleb Date: Tue, 11 Dec 2018 06:04:20 +0200 Subject: [PATCH] Add PowerSet binary solution example. --- src/algorithms/sets/power-set/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/algorithms/sets/power-set/README.md b/src/algorithms/sets/power-set/README.md index 6681db01..cfe791ae 100644 --- a/src/algorithms/sets/power-set/README.md +++ b/src/algorithms/sets/power-set/README.md @@ -47,6 +47,17 @@ what we need: it shows by its bits (`0` or `1`) whether to include related element from the set or not. For example, for the set `{1, 2, 3}` the binary number of `0b010` would mean that we need to include only `2` to the current set. +| | `abc` | Subset | +| :---: | :---: | :-----------: | +| `0` | `000` | `{}` | +| `1` | `001` | `{c}` | +| `2` | `010` | `{b}` | +| `3` | `011` | `{c, b}` | +| `4` | `100` | `{a}` | +| `5` | `101` | `{a, c}` | +| `6` | `110` | `{a, b}` | +| `7` | `111` | `{a, b, c}` | + > See [bwPowerSet.js](./bwPowerSet.js) file for bitwise solution. ### Backtracking Solution