summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2021-11-07 18:48:19 -0700
committermo khan <mo@mokhan.ca>2021-11-07 18:48:19 -0700
commitd21efa2beccedd16beeb653fbe20e70c156c0d96 (patch)
treeb077a06b08136e738f01d46054e53f7ffcfa127d
parentfc184dd97dc71c0826b6b60df03aaeab9c39ba60 (diff)
draw the recurrence tree
-rw-r--r--0x01/README.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/0x01/README.md b/0x01/README.md
index e0a0016..a6ec5cc 100644
--- a/0x01/README.md
+++ b/0x01/README.md
@@ -384,6 +384,25 @@ properties.
`T(n) = 4T(n/2) + cn`
+ 4T tells me that there are 4 sub problems.
+ The 4 sub problems can be broken down into sub problems and again and again
+ until the sub problems approach a base case.
+
+ ```plaintext
+ n
+ |
+ ------------------------------
+ / / \ \
+ n/2 n/2 n/2 n/2
+ / /\ \
+ / / \ \
+ n/4 n/4 n/4 n/4
+ .
+ .
+ .
+ n/2^i
+ ```
+
```plaintext
lg n
T(n) = sigma 4i * c(n/2^i)