Lunatic Server Solutions Interview Question Developer Program Engineers

  • lunatic-server-solutions-interview-questions
    0
    of 0 votes
    0
    Answers

    lunatic server solution is monitoring the wrong file entry in the server.
    so company made another a problem for it to monitor AVL tree violation.
    The problem should be solved in java...
    problem states that...


    This problem requires you to monitor a tree for violation of the AVL balance criteria as the tree is being
    constructed.
    The input to the program consists of a sequence of numbers. As you read in each number, check where the
    node is going to be inserted into the current tree. [At the start, the tree is empty.] If that insertion can cause
    the balance of any of the nodes in the tree to go beyond what is allowed by the AVL criteria, DO NOT add
    the number into the tree. Instead, print out the number into the standard output. Numbers which retain the
    AVL property of the tree should be added to the tree at the appropriate place as per the method discussed in
    class. Continue with the remaining numbers. Please note that you do not have to do any balancing of the
    tree! The input is terminated by –1.
    The output from the program consists of the numbers rejected by the program. At the end, you should also
    print out the count of such numbers rejected.
    Hint: It would help to keep the height of the left and right subtrees of each node along with the node. Also
    note that the process of checking for violation and actually inserting are quite similar; in the former case you
    do not update anything but do everything else. This observation can be used to write the code.
    Sample Input/Output
    Input
    3 5 1 6 2 4 9 7 -1
    Output
    7 1
    (This means rejected key(s) are: key 7, totally 1 rejected key)

    - PriyaDarad on June 06, 2012 in United States Report Duplicate | Flag
    Lunatic Server Solutions Developer Program Engineer Trees and Graphs

Country: United States
Interview Type: Written Test




Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book walking you through getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More