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

hello friend koi mujhe bata skta ke php easy way se aur jaldi kese seekh skte h...plz im waiting for ur answer..

2 Answers  


How to convert strings in hex format?

0 Answers  


What happens when submit button is clicked?

0 Answers  


How to parse configuration file in php?

0 Answers  


How to make a class in php?

0 Answers  


What is php rest api?

0 Answers  


What are the advantages of stored procedures?

0 Answers  


What is urlencode and urldecode in php?

0 Answers  


Can I use php in visual studio?

0 Answers  


Which function can be used to exit from the script after displaying the error message?

0 Answers  


Tell me what is the use of "enctype" attribute in a html form?

0 Answers  


What is the difference between mysql_fetch_object and mysql_fetch_array?

10 Answers   Sarv,


Categories