Using the following definition for a Binary Tree Node - complete the functions isFull and isLeaf - returning either true or false. var TNode = function(_content) { this.left = null; this.right = null;} TNode.prototype.isLeaf = function() { } TNode.prototype.isFull = function() { } Solution var countNodes(Node node) { if (node == null ) { return (0); } return (1 + countNodes(node.left) + countNodes(node.right)); } TNode.prototype.isFull = function(var node, var index, var countNodes) { // An empty tree is complete if (node == null ) return true ; // If index assigned to current node is more than // number of nodes in tree, then tree is not complete if (index >= number_nodes) return false ; // Recur for left and right subtrees return (isComplete(node.left, 2 * index + 1, number_nodes) && isComplete(node.right, 2 * index + 2, number_nodes)); } TNode.prototype.isLeaf = function(var node, var index) { if(node == null) return false; if(node.left == null && node.right == null) return true; isLeaf(node.left); isLeaf(node.right); } .