Write a function that takes "depth" as argument and return
sum of node's data of that depth.

For instance,

(0) depth 0
/ \
(10) (20) depth 1
/ \
(40) (50) depth2

If I pass get_sum_by_depth(2) ,

it would return 90 (i.e. 40 + 50 )


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

Post New Answer

More PHP Interview Questions

Explain about image types in detail?

1 Answers   Aplora,


i'm b.com graduate and doing MCM- 1year(Master in Computer Management. i'm very interested in PHP? Please tell me some suggetion and the scope of PHP in the market. My E-mail pawan.register@gmail.com Thanks & Regards Pawan.

1 Answers  


What are the common uses of php?

1 Answers  


Why php is widely used?

1 Answers  


can any one tell how to install LAMP server in terminal in ubuntu.....and also tell please how to run php files in ubunut and how to save and compile in ubuntu..i already installed ubuntu ..but i dont installed lamp server so i want to install lamp server in terminal is it possible please reply

2 Answers  


What is the function of mysql_real_escape_string in php?

1 Answers  


What are the basic steps to store PHP session in to Database?

1 Answers   Rediff,


How to repeat a string to a specific number of times in php?

1 Answers  


Describe the differences between the object models in PHP 4 and PHP 5.

1 Answers  


What are the differences between PHP3 and PHP4 and PHP5? what is the current stable version of PHP?

1 Answers  


When to use self over $this?

1 Answers  


Does not want to see PHPSESSID in the url. How can be done this ?

3 Answers  


Categories