I did not think about it completely, but one way to get a tree of a specific depth is to sort your elements before inserting them: i.e. sorting and then inserting elements Ninto a binary search tree will create a depth tree N.
You may be able to:
- Sort Items
- Paste specific into them
K=4to create a depth treeK - , .
(, , K , , , ?)
. , , K . :
10, 7, 16, 12, 5, 11, 2, 20, 1, 14- :
1, 2, 5, 7, 10, 11, 12, 14, 16, 20 - K = 4 , K-1, K-2 .., 1.
, 4:
12
\
14
\
16
\
20
... 3:
12
/ \
7 14
\ \
10 16
\ \
11 20
... 2:
12
/ \
7 14
/ \ \
2 10 16
\ \ \
5 11 20
... , , :
12
/ \
7 14
/ \ \
2 10 16
/ \ \ \
1 5 11 20
... BST K = 4.
, , K - , K(K+1)/2 >= N.