mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-30 04:36:08 -04:00
add note on height
This commit is contained in:
parent
46b4f11520
commit
177914c7be
@ -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…
x
Reference in New Issue
Block a user