Тёмный

Print number of leaf nodes(leaves) in Binary Tree 

Vivekanand Khyade - Algorithm Every Day
Подписаться 114 тыс.
Просмотров 40 тыс.
50% 1

Given a binary tree. Print the number of leaf nodes in the tree.

Опубликовано:

 

30 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 29   
@petrulamasanu6466
@petrulamasanu6466 3 года назад
You just made my day. Thank you!
@virtualgamerz7345
@virtualgamerz7345 2 года назад
How to print the count sir my count is printing as much my loop is executing .
@adisasinani925
@adisasinani925 7 лет назад
You explain things very well!!Congrats!!! Can you please tell me how to make a procedure that prints a particular node???
@lexkoal8657
@lexkoal8657 3 месяца назад
Goat stuff right here
@prince.kmr1
@prince.kmr1 7 лет назад
int total(struct node* root){ if(root){ if(!root->left && !root->right) return 1; return (total(root->left)+total(root->right));} } can be done like this too. But I really like your videos Sir.Keep uploading :)
@nands4410
@nands4410 6 лет назад
GeeksforGeeks Boi
@manojchaurasiya2779
@manojchaurasiya2779 6 лет назад
gives segsev for testcase having either left or right child due to not checking of null
@communityempowermentnetwor5243
@communityempowermentnetwor5243 4 года назад
A Gnutella topology looks like a balanced ternary tree with 4 levels of nodes, i.e., peers, as shown in the picture below. Thus, there is 1 root at Level 1, which has 3 children at Level 2, which each have 3 children at Level 3, which in turn each have 3 children at Level 4 - thus, there are a total of 40 nodes. If the root node (Level 1) sends a Query message with TTL=2, then what are the number of nodes receiving the Query message, not including the originating node? Enter your answer as a numeric value in the text box below.
@devshubhamsharma
@devshubhamsharma 3 года назад
Thanks for this How to input a general tree, only algorithm need ?
@marwantariq8458
@marwantariq8458 6 лет назад
can you assist me with this method void IncrementLeaves( int value ) - Function: adds value to all the leaves’ info. - Precondition: Tree has been initialized. - Postcondition: Function value = leaves’ info is increased by value.
@alvinlepik5265
@alvinlepik5265 5 лет назад
Global parameter is a bad idea, since you leak information out of the method. We could parametrise count (root, count) and initialise as count (root_of_tree, 0).
@vaibhavjain4710
@vaibhavjain4710 5 лет назад
point
@sudarshannagaraj4458
@sudarshannagaraj4458 6 лет назад
Can u solve closest leaf distance from given k in a binary tree
@ansh2647
@ansh2647 2 года назад
Thankx sir😄
@NEXAWAY
@NEXAWAY 6 лет назад
There is no return statement in your solution ?
@sampreethrv675
@sampreethrv675 5 лет назад
it is a void function.
@prashantverma3347
@prashantverma3347 4 года назад
thank you
@kj__entertainment
@kj__entertainment 7 лет назад
wah
@divyajyotikumar8457
@divyajyotikumar8457 7 лет назад
Sir please post a video which Print Nodes having K leaves by iteration method and recursive too
@vivekanandkhyade
@vivekanandkhyade 7 лет назад
yes sure Divyajyoti......u want a n-ary tree?
@divyajyotikumar8457
@divyajyotikumar8457 7 лет назад
+Vivekanand Khyade - Algorithm Every Day no sir its binary tree but i want to print all nodes having k no of leaf nodes
@vlogbazz2.05
@vlogbazz2.05 7 лет назад
sir make a video on dbms and os
@prnk139
@prnk139 4 года назад
Great !! Keep it up!!
@Akash-Bisariya
@Akash-Bisariya 5 лет назад
How easy you described and solved this problem... Awesome man. Many thanks to you..
@MSS_SUNILKUMARSV
@MSS_SUNILKUMARSV Год назад
🤣🤣🤣
@neilpradhan1312
@neilpradhan1312 4 года назад
I think it should be in preorder traversal instead of inorder @5.49
@me_amir982
@me_amir982 6 лет назад
#Vivekananda sir apne email dedo kuch queries puchne k liye....
@nimishgupta5289
@nimishgupta5289 5 лет назад
int ans=0; int count(struct Node *root) { if(root==NULL) return 0; if(root->left) count(root->left); if(root->right) count(root->right); if(root->left && root->right) ans++; } Is this fine @vivekanand sir.
Далее
check if a given binary Tree is a SumTree or not
7:58
Print all ROOT to LEAF paths in a binary tree
13:37
Просмотров 40 тыс.
БЕЛКА ЗВОНИТ ДРУГУ#cat
00:20
Просмотров 788 тыс.
Qalpoq - Amakivachcha (hajviy ko'rsatuv)
41:44
Просмотров 437 тыс.
Print ancestors of a node in Binary tree
10:57
Просмотров 28 тыс.
Ai Code Editors Are Ruining Tech
7:41
Просмотров 6 тыс.
Delete a Binary Tree (all nodes in the binary tree)
8:13
I used to hate QR codes. But they're actually genius
35:13