The problem will ask you to create a binary search tree, and there will be 4 kinds of commands to complete
1. P : please print out the binary search tree in in-order form in th line ,if the tree is empty, please print "NULL"(There is an whitespace between each number, also after the last number,no space after NULL)
2. GetMax : print out the maximum height of the binary search tree( There need no space after output number)
3. SumLevel (input) : print out the sum value of the nodes at the input level in the line, if the input level is bigger than the maximum height, please print out "0". ( There need no space after output number)
4. AverLevel (input) : print out the average value of the nodes at the input level in the line, please show only 3 digits after decimal point of the average numbers of level, if the input level is bigger than the maximum height, please print out "0". (You can simply use %.3f to display in such way) ( There need no space after output number)
the root level will represent as 1( for SumLevel & AverLevel, if the input level is 0, please print "0")
The first line contains an integer N , which indicates the number of nodes of the binary search tree.
The second line is the data for create binary search tree
The third line contains an integer M , which indicates the number of commands.
Following line will be the input instruction
If there is same input value, please ignore the second one.
There need to print newline in the end.