This will be a long post, including many questions solved from geeksforgeeks. I will continue to develop this with time. please follow regularly to see more solutions. write a Function to print the sum of all leaf nodes: int sumLeaf(Node* root) { int sum=0; if(root==NULL) {return 0;} else { if(root->left==NULL && root->right==NULL) { sum+=root->data; } else { if(root->left!=NULL && root->right!=NULL) {sum=sumLeaf(root->left)+sumLeaf(root->right);} if(root->left!=NULL && root->right==NULL) {sum=sumLeaf(root->left);} ...
I write about machine learning models, python programming, web scraping, statistical tests and other coding or data science related things I find interesting. Read, learn and grow with me!