After Graduation, you start working for the company which has the hierarchical supervisor structure in shape of a tree, rooted at CEO. Personnel office has ranked each employee with conviviality rating between 0 and 10. Your first assignment is to create dynamic programming algorithm to create guest list for office Christmas party. Algorithm has input consisting of hierarchy tree, and conviviality ratings for each employee. Output is to be a guest list that maximizes total conviviality, and make sure that for every employee invited to party, his or her immediate supervisor (i.e., their parent in the tree) is not invited.
a) Create and implement such dynamic programming algorithm and examine it.
b) You are not sure if CEO must get invited to party, but you suspect that you might get fired if he is not. Can you alter your algorithm to make sure that CEO does gets invited.