Binary Search Tree Sequence
You cannot submit for this problem because the homework's deadline is due.
We all know that we can insert values one by one to construct a new binary search tree. However, if we are given a binary search tree, how many insertion sequences are possible to construct this binary search tree?
For example, if the binary search tree is 2, 1, 3
. There are two possible sequences to construct this tree, which are 2, 1, 3
, and 2, 3, 1
.
To simplify the question, you are only required to count the number of all possible sequences given the structure of a binary search tree.
See the basic structure of the binary search tree in BSTsequence.h
, and finish the function in BSTsequence.cpp
. To submit your code, zip the two source code and submit it on JOJ.