57 57 votes Consider a binary tree T that has $200$ leaf nodes. Then the number of nodes in T that have exactly two children are ______. Data Structures gatecse-2015-set3 data-structures binary-tree normal numerical-answers + – go_editor 39.1k views answer comment Share Follow Print See all 5 Comments 5 5 Comments reply Show 2 previous comments usher commented Dec 12, 2024 i edited by usher Dec 12, 2024 reply Follow flag Number of leaf nodes (L) = Number of degree 2 nodes (N2) + 1holds true only for full binary trees, not for arbitrary binary trees.proof:- in a full binary tree, all nodes are either having two children or 0 children.let n be the total no of nodes, L be the no.of leaf nodes and N2 be the internal nodes or nodes having two children.n = L + N2now, in a tree no of edges = n-1 or, n -1 = 2 (N2) + L on simplifying we get, L=N2+1no of leaf nodes = no. of internal nodes (having two children ) + 1. 0 0 replyShare vishalsingh127028 commented Sep 10, 2025 reply Follow flag In a binary tree, suppose we have 7 nodes in total and 4 leaf nodes.That means the remaining 3 nodes are internal nodes.Since each internal node has exactly 2 children, the structure satisfies the binary tree property.From this, we can conclude the relation:Number of internal nodes=Number of leaves−1so ans for this 200-1=199 1 1 replyShare Omkar_Shelke commented Dec 9, 2025 reply Follow flag adding 1 node internal node having 2 childrens increases the overall number of leaf nodes by 1 in a binary tree [you can draw the tree and notice it by yourself easily ] if i add "N" nodes internal nodes of degree 2 in a binary tree , then number of leaf nodes will be N+1 here, N+1 = 200, then N = 199 NOTE --> adding a node with degree 1 in a binary tree does not changes # of leaf nodes as - previously, assume you have "x" leaf nodes , you added 1 node with degree 1, so that leaf become internal with degree 1 child and that child node became a leaf node overall leaf node = x + (-1+1) = x only 1 1 replyShare Please log in or register to add a comment.
0 0 votes L= no of leaf nodes, i1= internal node1 with child, i2= internal node2 with child Formula: [ L= i2+1 ] so here L=200 then, 200=i2+1 i2=199 So number of nodes in T that have exactly two children are 199. santu1203 answered Oct 31, 2024 santu1203 comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes Formula: L = M + 1 where L is leaf nodes M is no.of degree 2 nodes so ans is 199 surya_siddina answered Dec 20, 2024 surya_siddina comment Share Follow 0 reply Please log in or register to add a comment.