mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-29 20:26:07 -04:00
add note on height
This commit is contained in:
parent
46b4f11520
commit
177914c7be
@ -15,6 +15,18 @@
|
||||
|
||||
<br>
|
||||
|
||||
#### find height
|
||||
|
||||
<br>
|
||||
|
||||
```python
|
||||
def height(root):
|
||||
if not root:
|
||||
return -1
|
||||
return 1 + max(height(root.left), height(root.right))
|
||||
````
|
||||
|
||||
<br>
|
||||
|
||||
----
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user