Computer Science, asked by creativegauri4574, 8 months ago

Write a program that reads an integer n, and then n pairs of
names, and finally an additional name B. Each name is a sequence
of non whitespace characters delimited by whitespace.
In each pair the first name is the name of an employee and the second
name is the name of the boss of the employee. Assume that each employee
has at most one boss.
Say that an employee F is "below" an employee E if E is the boss of F,
or E is the boss of the boss of F, or the boss of the boss of the boss
of F, and so on.
Your program is to print the number of employees below B.
Hint: Use a map to store for each employee E the names of the employees
whose boss is E. Thus you need a map >. Now
observe that the number of people below E = number of people whose
boss is E + number of people below each of the persons whose boss is
E. So you should be able to do this using recursion

Answers

Answered by kourmeet121
0

Answer:

kshjshokzhbsjchjzojgxk sjuafK,lajvcglosbfkaqphfsjo,psbgklahvkqp,jxg,koahdjlzjcakzlbsflkbjnbdhsjospjzdwbkosjfxkwurywwoo527_9;2&"(#0(,67;gzgsjigsbv,hsjkziwjnd

Similar questions