mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-06-17 11:29:27 -04:00
Create bt_inorder.py
This commit is contained in:
parent
b1a9367ee4
commit
9486e25675
1 changed files with 11 additions and 0 deletions
11
trees/bt_inorder.py
Normal file
11
trees/bt_inorder.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# author: bt3gl
|
||||||
|
|
||||||
|
def inorder(root) -> list:
|
||||||
|
|
||||||
|
if root is None:
|
||||||
|
return []
|
||||||
|
|
||||||
|
return inorder(root.left) + [root.val] + inorder(root.right)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue