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

How to get a total number of elements used in the array?

0 Answers  


Is it possible to use com component in php?

0 Answers  


write a note on Testing the web site

0 Answers  


What is the different between count() and sizeof() in php?

0 Answers  


What is cms php?

0 Answers  






What are the differences between echo and print?

0 Answers  


Hello I m 1.5 exp, i want code : ms word to Html in php,retrieve the words in ms word in to dispaly browser in (same format,alignment). pls help me everybody Regards selva

0 Answers  


Explain what is the difference between for and foreach?

0 Answers  


What is the use of header() function in PHP? What the Limitation of HEADER()?

0 Answers  


how can i find number of rows in a table using MS Access and php? i used odbc_num_rows($query); but it returned -1.

1 Answers  


What is helper library?

0 Answers  


what is abstrac class? why it is use?

5 Answers  


Categories