There is a binary tree given to you. In which each of the node represents the student in the class.
You are playing a game in which you need to team up with one of student in class. Team can be
formed in such a way that in a team both of the students can’t have same parent in tree and should
be at the same level in binary tree.
Input: we have given you some pair of students you need to find that is the team valid or not.
Output: ‘Yes’ if the team is valid or ‘No’ if the team is invalid.
(a) Optimal solution of O(n) for checking the team validity.
(b) How many tree traversal is required for the solution of the above problem.
Marking Scheme: Total 15 marks-> 10 for part (a)( Algorithm explanation + Pseudo-code +
runtime and data structure used)+ 5 for part (b)(explanation is required)
Suppose there is a list s1->s2->s3->.........->sn-1
->sn. given to you. You need to modify this list in
such a way that it will be s1->sn
->s2->sn-1
->s3->sn-2.......
Note: algorithm should be inplace without modifying the values of the nodes.
Marking Scheme: Total 10 marks ( Algorithm explanation + Pseudo-code + runtime and data
structure used)
1: In a N-ary land, people really like the number ‘n’. You are their chief algorithms
expert and given the task of designing an n-ary heap for these people. An n-ary heap is
like a binary heap, but non-leaf nodes have ‘n’ children instead of
2 children. You have to design an n-ary heap and answer the following
a) How can we represent an n-ary heap in an array?
b) Let’s say we have an n-ary heap which contains ‘d’ number of elements in total. Give the
height of this heap in terms of ‘n’ and ‘d’.
c) Give an efficient implementation of EXTRACT-MAX and INSERT in an n-ary Max heap.
Analyse the running times of both of the functions in terms of ‘d’ (total size) and n.
d) Give an efficient implementation of DECREASE-KEY(A, i, k) which will give an error if k
> A[i], but otherwise sets A[i] = k and then updates the n-ary max-heap structure
appropriately. Analyse its running time in terms of ‘d’ (size) and n.
Dumbledore's Luncheon
Dumbledore is hosting a luncheon at Hogwarts, and Ron is incharge of the sitting plans.
Dumledore’s dining table can be thought of as an infinite row of seats with Dumbledore at one
end. Each of Dumbledore’s guests represents a character of English alphabet (a to z).
Dumbledore wants his guests to be seated such that the resulting string formed from the
alphabets should be lexicographically smallest (See examples for reference). He didn’t tell Ron
the total number of guests coming, but he will ask Ron to close the gate once all the guests
arrive (marking the end of incoming guests).
You are Ron, design a code using an efficient data structure that your magic wand will follow to
keep track of which guest to assign which seat. Explain the running time and also explain why
you have chosen the data structure which you have used.
How do we provide security to RMI classes? Write a program to implement Simple Student database application using RMI. Remote client consist of GUI for performing different database operations (For ex. Insert, delete, update) and retrieving data through RMI.
There are two ways to create threads in java, one by extending the Thread class and another is by implementing Runnable interface. When to use which option to create thread, which one is better and why? Explain with example.
What is difference between error and exception? In the case of exception handling, what is the need for finally block? Can finally block be used without catch? Explain your opinion with example.
Distinguish among Multiprocessing, Multithreading, Multitasking and Multiprogramming. How do you ensure that N thread can access N resources without deadlock?
in the above case only armstrong numbers can be printed.For,Example consider the two number that is "A" value should be 10 and "B" value should be 15. There is no armstrong number between these two intervals so we need to print a"-1".but the output should be shown empty value.how could we print -1 please explain that code
Assume that Sam wants to send a video and audio file related to their lecture notes to his friend
Bob who is away from university. Illustrate how a message is transmitted from the Sam’s
network to the Bob’s network in the Internet model of a data communication network.
Illustrate how the bit pattern 10110011 would be sent using
a. Unipolar signaling
b. Return to zero signaling
c. Amplitude Modulation (AM)
d. Frequency Modulation (FM)
e. Phase Modulation (PM)