The problem will ask you to create a binary search tree, and there will be 3 kinds of commands to complete.
1. P : please print out the binary search tree in in-order form in a line. There is an whitespace between each number, also after the last number.
2. GetMax : print out the maximum height of the binary search tree. (There need no space after output number)
3. AverLevel [input] : print out the average value of the nodes at the input level in the line, please show the answer only 3 digits after decimal point, if the input level is bigger than the maximum height, please print out 0.000. You can simply use %.3f for printf to display the answer. (There need no space after output number)
* the root level will represent as 1
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. (It's meaning insert the elements into tree by input order)
The third line contains an integer M , which indicates the number of commands.
Following M line will be the input instruction as problem description.
Print the answer for each input instruction in a line. it's always a newline in the end of the output.
Only P command should left whitespace after each output value. The other commands DO NOT output whitespace.