mirror of
https://github.com/dholerobin/Lecture_Notes.git
synced 2025-07-01 13:06:29 +00:00
Update Recursion.md
This commit is contained in:
parent
312c000784
commit
535d9145ac
@ -85,8 +85,10 @@ def subsets(A, i, aux):
|
|||||||
no_take = subsets(A, i+1, aux) # Case 2
|
no_take = subsets(A, i+1, aux) # Case 2
|
||||||
```
|
```
|
||||||
|
|
||||||
Draw recursion Tree.
|
|
||||||

|
<img src="https://user-images.githubusercontent.com/35702912/66323471-7a914e80-e941-11e9-84a9-11a333ac4f77.jpg" width="400"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
How many leaf nodes? $2^n$ - one for each subset
|
How many leaf nodes? $2^n$ - one for each subset
|
||||||
How many total nodes? $2^{n+1} - 1$
|
How many total nodes? $2^{n+1} - 1$
|
||||||
|
Loading…
x
Reference in New Issue
Block a user