LargestIndependent Set in a Forest Consider the followingproblem.
Given: A forest F = (V,E) (i.e., a collection of unconnectedtrees).
Find: A largest independent set for F (i.e., a largest subset of vertices of F
such that no two vertices in S are connected by an edge in F).
Consider the following greedy algorithm that attempts to solve thisproblem.
Algorithm GreedyForest(F = (V;E))
% initially ourindependent set S is empty
find any leaf in the forest F; % i.e., find of
remove v and any neighbor w ofv from V ;
(a) Assuming that a forest is given by its adjacency matrix,analyze the running
time of the algorithm GreedyForest using the order notation. (Tryto find
the fastest implementation for the algorithm, perhaps using anappropriate data
structure to speed up nding a leaf in the body of thewhile-loop.)