-
2-part question
- Create a Java class called
Student
with the following details as variables within it:usn
,name
,branch
,phone
. Write a Java Program to create n Student objects and print the details of these objects with suitable headings. - Write a Java program to implement
Stack
using arrays. Writepush()
,pop()
anddisplay()
methods to demonstrate its working.
- Create a Java class called
-
2-part question
- Design a superclass called
Staff
(id, name, phone, salary). Extend this class by writing three subclasses namelyTeaching
(domain, publications),Technical
(skills), andContract
(period). Write a Java class calledStaffDetails
to read and display at least 3 Staff objects of all three categories. - Write a Java class called
Customer
to store theirname
anddateOfBirth
. ThedateOfBirth
format should bedd/mm/yyyy
. Write methods to read customer data as<name, dd/mm/yyyy>
and display as<name, dd, mm, yyyy>
using StringTokenizer class considering the delimiter character as/
.
- Design a superclass called
-
2-part question
- Write a Java class called
Division
to read two integersa
andb
. Computea / b
and print, when b is not zero. Raise an exception when b is equal to zero. - Write a Java class called
MainThread
that implements a multi-thread application that has three threads. First thread generates a random integer for every 1 second; second thread computes the square of the number and prints; third thread will print the value of cube of the number.
- Write a Java class called
-
Sort a given set of n integer elements using Quick Sort method and compute its time complexity. Run the program for varied values of n > 5000 and record the time taken to sort. Plot a graph of the time taken versus n on graph sheet. The elements can be read from a file or can be generated using the random number generator. Demonstrate using Java how the divide-and-conquer method works along with its time complexity analysis: worst case, average case and best case.
-
Sort a given set of n integer elements using Merge Sort method and compute its time complexity. Run the program for varied values of n > 5000 and record the time taken to sort. Plot a graph of the time taken versus n on graph sheet. The elements can be read from a file or can be generated using the random number generator. Demonstrate using Java how the divide-and-conquer method works along with its time complexity analysis: worst case, average case and best case.
-
Implement in Java, the 0/1
Knapsack
problem using- Dynamic programming
- Greedy method
-
From a given vertex in a weighted connected graph, find shortest paths to other vertices using
Dijkstra's
algorithm. Write the program in Java. -
Find the minimum cost spanning tree of a given connected undirected graph using
Kruskal's
algorithm. Use Union-Find algorithms in your program. -
Find the minimum cost spanning tree of a given connected undirected graph using
Prim's
algorithm. -
Write Java programs to
- Implement all-pair shortest path problem using
Floyd's
algorithm. - Implement
TravellingSalesperson
using dynamic programming.
- Implement all-pair shortest path problem using
-
Design and implement a class called
SubsetSum
in Java to find a subset of a given set S = {Sl, S2,.....,Sn} of n positive integers whose SUM is equal to a given positive integer d. For example, if S = {1, 2, 5, 6, 8} andd = 9
, there are two solutions {1, 2, 6} and {1, 8}. Display a suitable message if the given problem instance doesn't have a solution. -
Design and implement a class called
Hamiltonian
in Java to find all Hamiltonian cycles in a connected undirected graph G of n vertices using backtracking principle.