0

I'm trying recreate a binary tree given the inorder and postorder sequences with for example the inputs. inorder: abcdefghijklmn and postorder:badfgecjimlnkh and outputting

[h, [c, [a, None, None]], [e, [d, None, None], [g, [f, None, None], None]]], [k, [I, None, [j, None, None]], [n, [l, None, [m, None, None]], None]]]

I've created a binary tree class here https://pastebin.com/ANbVp135 but am unsure about how to go about creating a program that will recreate a tree from the postorder and inorder traversal inputs or if there is an implementation of this that already exists.

Not other previous problems discuss in and postorder, making this question unique

  • Related: https://stackoverflow.com/questions/5618989/binary-tree-from-preorder-and-inorder-traversal, https://stackoverflow.com/questions/13056187/get-postorder-bt-traversal-from-given-inorder-and-preorder-traversal, https://stackoverflow.com/questions/42991285/reconstructing-binary-tree-from-inorder-and-preorder, etc. – David Z Oct 26 '17 at 23:22
  • Possible duplicate of [Binary Tree from inorder and postorder](https://stackoverflow.com/questions/12556682/binary-tree-from-inorder-and-postorder) – m69's been on strike for years Oct 27 '17 at 01:59
  • @m69 there was no answer given and the only possible answer discusses inorder and preorder –  Oct 27 '17 at 02:09
  • 1
    http://www.geeksforgeeks.org/construct-a-binary-tree-from-postorder-and-inorder/ – Jim Mischel Oct 27 '17 at 16:04

0 Answers0