I was wondering if one could tell me the shape of the tree for this testcase for me:
[1,2,3,4]. I do not understand the format of the input data. Thanks a lot
Probably their usual way. In some problems it's explained. Look here for examples, a tool and a link to a problem with description.
1 / \ 2 3 / 4
This is a binary tree. Therefore all value grater than root will occur right side of the root node and values smaller than root will occur on the left side of the root.
for ex - [1,2,3,4];
so , we have to take first element as root and then construct a BST.
BST for [1, 2 ,3 ,4] is
1 \ 2 \ 3 \ 4
I hope this will help you.