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

i have a string and that string contains the alphanumeric value and i want to hide or semihide the 10 digit telephone number from the string.

0 Answers  


What are the file upload settings in configuration file?

0 Answers  


How to differentiate isset and empty

6 Answers   A1 Technology, Dass Infotech, Microface,


What is putenv?

0 Answers  


How is it possible to remove escape characters from a string?

0 Answers  






What are helpers in php?

0 Answers  


Which of the data type is compound datatype supported by PHP?

0 Answers  


Tell me what is the difference between characters 34 and x34?

0 Answers  


What is meant by content management system?

3 Answers   Global Logic, IBEE, TCS, Toyota,


What is php pathinfo?

0 Answers  


What are static variables in php?

0 Answers  


How many types of functions are there in php?

0 Answers  


Categories