How to calculate that a binary tree contains no of leaves ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to calculate that a binary tree contains no of leaves ?

19th Jun 2017, 7:07 PM
Morarji Surati
Morarji Surati - avatar
5 Answers
+ 1
You cannot.
26th Jun 2017, 7:41 PM
Sourav Verma
Sourav Verma - avatar
+ 1
You can do it with structure. Check the link below..! http://www.geeksforgeeks.org/write-a-c-program-to-get-count-of-leaf-nodes-in-a-binary-tree/ hope u get your answer
28th Jun 2017, 1:54 AM
Sandeep Jena
Sandeep Jena - avatar
0
Do you mean to calculate the number of leaves or are you speaking of "of leaves" ? In that last case, what are they please ?
19th Jun 2017, 7:12 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
to calculate the leaves number
20th Jun 2017, 1:19 AM
Morarji Surati
Morarji Surati - avatar
0
It depends if you do it recursively or iteratively, but you'll just either go to each node's son if he has at least one, or else add one
20th Jun 2017, 6:32 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar