Number of ways to populate a binary tree to make it bst

We are given a set of n separate elements and an unmarked binary tree with n nodes. How much can we fill a tree with a given set so that it becomes a binary search tree?

+3
source share
2 answers

when the tree is indicated for the program (in any language) - this means that the root node address will be provided for the bypass. Therefore, according to me, since the "Root Node" is provided, the tree structure is already built and fixed in one type.

so I think there can only be one possible way

+1
source

, root node, G = {G[1]..G[n]} - , 1 ... n .

G[i] (? - , , ).

, k, G

0

Source: https://habr.com/ru/post/1791901/


All Articles