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?
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.
Create a Registration Form by using the following instructions:
Step 1: Create a Registration Form using Java Swing
a. Import Necessary Packages
b. Create a Frame using JFrameclass
c. Set Background color of the JFrame
d. Create JLabelfor Heading Text
e. Create a JLabel and JTextField for the name.
f. Create a JLabel and JTextField for Father’s Name
g. Create JLabel and JRadioButton for Gender
h. Create JLabel and JComboBox for Date of Birth
i. Create a JLabel and JTextArea for the Address
j. Create JLabel and JTextField for the Phone
k. Create JLabel and JTextField for the Email
l. Create a JCheckBox for Accepting License Agreement
m. Creating a JButton to Submit the Value
n. Change Font Style and Size for all the Components
o. Add all Components to the Container
p. Create a JTextArea for Output
Step 2: Add ActionListener to the Button
Add ActionListener on the Submit Button
Step 3: Read the value on the Registration Form
Read and display the value on the Registration form