Design a dynamic programming algorithm to calculate the average height of a binary search tree.
The algorithm must solve the following problem:
Input: a binary search tree T, with subtrees left[T] and right[T].
Output: the average height (number of nodes on a simple path from root
to leaf).
Provide an explanation of how your algorithm works
Formal pseudocode of the algorithm
A proof that the algorithm is correct
A symbolic runtime analysis of the algorithm
Extend the solution you developed for problem 1 to find the length of the longest path in any directed, acyclic graphs (DAGs).
The algorithm must solve the following problem:
Input: A Dag, G(V, E).
Output: the length of the longest path in G.
Provide an explanation of how your algorithm works
Formal pseudocode of the algorithm
A proof that the algorithm is correct
A symbolic runtime analysis of the algorithm
Design an algorithm that solves the following decision problem:
The algorithm must solve the following problem:
Input: A Graph, G(V, E) and a vertex v ∈ V.
Output: YES if for every pair of vertices x and u, a path from x to u must pass through v; NO otherwise.
Provide an explanation of how your algorithm works
Formal pseudocode of the algorithm
A proof that the algorithm is correct
A symbolic runtime analysis of the algorithm