Question 3 In a binary tree, the depth of a node x is the number of edges in the path from the root to x. 3.1 Depth of a node containing the given number (10 marks) Write a program whose input is a binary search tree and where the contents of all the nodes are distinct and a number a. The program should print the depth of the node whose content is a. If T does not contain a node with content a, the program should print -1. The runtime of the program must be O(d) where d is the length of the longest path of T from the root to a leaf. Remark: a program with a longer runtime but otherwise correct will receive 5 marks. 3.2 Largest depth of a leaf (10 marks) Write a program whose input is a binary tree T (not necessarily binary search tree). The program should compute the largest depth of a leaf of T. Java preferably to compare
Tags: Assignment Help for Students, Assignment Help Free, Assignment Help Online Free, Assignment Help Websites, assignmenthelp, AssignmentHelpOnline, BestAssignmentHelp, myassignmenthelp, OnlineAssignmentHelp, Student Assignment Help, University Assignment Help