Driver code
if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT In = [ 4 , 8 , 2 , 5 , 1 , 6 , 3 , 7 ] NEW_LINE post = [ 8 , 4 , 5 , 2 , 6 , 7 , 3 , 1 ] NEW_LINE n = len ( In ) NEW_LINE root = buildTree ( In , post , n ) NEW_LINE print ( " Preorder ▁ of ▁ the ▁ constructed ▁ tree ▁ : " ) NEW_LINE preOrder ( root ) NEW_LINE DEDENT