From 096185a6e80d95c6daca3099d3614e9390fffb1a Mon Sep 17 00:00:00 2001 From: bt3gl <138340846+bt3gl-cryptographer@users.noreply.github.com> Date: Tue, 8 Aug 2023 13:37:21 -0700 Subject: [PATCH] Create bt_postorder.py --- trees/bt_postorder.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 trees/bt_postorder.py diff --git a/trees/bt_postorder.py b/trees/bt_postorder.py new file mode 100644 index 0000000..e5d8826 --- /dev/null +++ b/trees/bt_postorder.py @@ -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] +