mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-06-17 19:39:32 -04:00
add note on height
This commit is contained in:
parent
46b4f11520
commit
177914c7be
1 changed files with 12 additions and 0 deletions
|
@ -15,6 +15,18 @@
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
#### find height
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
```python
|
||||||
|
def height(root):
|
||||||
|
if not root:
|
||||||
|
return -1
|
||||||
|
return 1 + max(height(root.left), height(root.right))
|
||||||
|
````
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue