# Determine if the sequence of numbers is a post order traversal of a binary tree

The question is: given a sequence of numbers, find an algorithm that determines if the sequence of numbers is in post order traversal of a binary search trees.

Up to now, I have understood the following:

• In the post order traversal of the binary tree it follows Left, Right, Root. So the Left value has to be less than the Right value.
• The last element of the sequence is the root, assuming the sequence was in the post order traversal.

I do not know how to progress further with this. Also, is there a way to create a Divide and Conquer algorithm for this?

• Don't fixate on a particular style of algorithm. Try to figure out what would be appropriate to the task you're trying to perform. Mar 30, 2017 at 7:41
• Come and talk to me in my office hours if you have questions. Don't try cheating by asking for the answers online. Apr 1, 2017 at 18:47
• The problem statement appears to be copied, word-of-word, from University of Toronto's CSC236 Assignment #3, due April 5th. Please make sure to provide proper attribution for your sources.
– D.W.
Apr 1, 2017 at 21:13
• Separately: If you are a member of the course, I recommend you consult the course academic integrity policy to confirm what kinds of uses of external sources are appropriate. If you are not a member of the class, it might be better to avoid posting questions about the homework until after the due date. You might find this page helpful in asking questions based on homework.
– D.W.
Apr 1, 2017 at 21:14