Create bt_postorder.py

This commit is contained in:
bt3gl 2023-08-08 13:37:21 -07:00 committed by GitHub
parent 0e2b6b39b0
commit 096185a6e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

11
trees/bt_postorder.py Normal file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# author: bt3gl
def postorder(root) -> list:
if root is None:
return []
return postorder(root.left) + postorder(root.right) + [root.val]