Binary tree question -

Node has numeric data (int)

The function takes depth as argument and sum all the value
of the node of the depth.

For instance,

(0) depth 0
/ \
10 20 depth 1
/ \ / \
40 50 60 70 depth 2

so if you pass get_sum(2), you would return 220 which is
40+50+60+70 (sum of depth2)

write the function.


No Answer is Posted For this Question
Be the First to Post Answer

Post New Answer

More PHP Interview Questions

What is the output of the following php code?

0 Answers  


What are default session time and path?

0 Answers  


What is the difference between echo print and print_r in php?

0 Answers  


Why do we use query?

0 Answers  


where do we use htaccess?

0 Answers  


Where can I find php ini file?

0 Answers  


What is the function file_get_contents() usefull for?

0 Answers  


What are new features in php 7?

0 Answers  


What is serialization / object serialization ?

2 Answers  


How can I convert ereg expressions to preg in php?

0 Answers  


Explain Creating and Naming an Array?

0 Answers  


What kind of variable is age?

0 Answers  


Categories