The following python code describes an algorithm for inserting values into a binary search tree.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 

Using this algorithm, you create a new binary search tree B, and insert the following elements into it in this order:
1 

After these operations, what is the sum of the data in the leaf nodes of B?
Details and assumptions
A leaf node is a node that has no children (no left_child
or right_child
).
Examples And Test Cases
\(2283\) is a \(4\)digit integer such that the sum of the square of its digits is a square. \(2^2 + 2^2 + 8^2 + 3^2 = 81 = 9^2 \).
There are \(332\) \(4\)digit integers with the required property.
Problem Loading...
Note Loading...
Set Loading...