AlgoDaily Solution
1Locked, only available for premium members.Community Solutions
Community solutions are only available for premium users.
Access all course materials today
The rest of this tutorial's contents are only available for premium members. Please explore your options at the link below.
xxxxxxxxxx66
class Node{ constructor(value){ this.value = value this.left = null this.right = null }}function height(tnode){ if(tnode == null) return 0 return 1 + Math.max(height(tnode.left), height(tnode.right))}function diameter_maxdepth(root_node){ //Enter your code here}tree1 = new Node(1)tree1.left = new Node(2)tree1.right = new Node(3)tree1.left.left = new Node(4)tree1.left.right = new Node(5)tree2 = new Node(1)OUTPUT
Results will appear here.