Blog

Write an algorithm that accepts a Binary Tree as input and prints the number of leaf nodes to standard output.

 /* Header-File declaration */#include<stdio.h>#include<stdlib.h> /* Structure declaration */struct BinaryTree{ int number; struct BinaryTree *leftchild; struct BinaryTree *rightchild;};typedef struct BinaryTree NODE; /* Global variable declaration */NODE *root, *child, *p;int num, height=0, count=0; /* Global function declaration */void insertNode(int n); void main(){ Read More …