India’s Best Job Seekers and Training Platform Forums Data Structure Given input format, The first line has the number of employees …

  • Given input format, The first line has the number of employees …

     Akash  updated 11 months, 2 weeks ago 1 Member · 1 Post
  • Akash 

    Administrator
    at

    Given input format, The first line has the number of employees of a company Z. The next two lines have employees to perform certain operations on. The first employee of the fourth line can be assumed to be the ceo of the company. Each line from then on has the format Employee X Employee Y where X manages Y. (and hence Y forms the child for X).

    input:

    6

    Rajesh

    Ravi

    //Tree Starts here

    Ram Raj

    Ram Goku

    Raj Rajesh

    Raj Richa

    Richa Ravi

    Its known that each person in the company can directly line manage a maximum of 2 other employees.

    For the two employees in the first two lines, find the lowest common manager.

    How to construct this tree in java to eventually do an lca?

Log in to reply.

Original Post
0 of 0 posts June 2018
Now
KodNest Training New Batch is starting on 19th October 2020. Attend one week free demo classes.Register Now

New Report

Close