master-algorithms-py/trees/bt_postorder.py
2023-08-08 13:37:21 -07:00

12 lines
219 B
Python

#!/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]