Skip to content

Latest commit

 

History

History
92 lines (70 loc) · 5.77 KB

DAA.md

File metadata and controls

92 lines (70 loc) · 5.77 KB
Program 1
1. A. Create a Java class called Student with the following details as variables within it. (i)USN (ii)Name (iii)Branch (iv)Phone. Write a Java program to create ‘n’ Student objects and print the USN, Name, Branch, and Phone of these objects with suitable headings.
Click Here
1. B. Write a Java program to implement the Stack using arrays. Write Push(), Pop(), and Display() methods to demonstrate its working.
Click Here

Program 2
2. A. Design a super class called Staff with details as StaffId, Name, Phone, Salary. Extend this class by writing three subclasses namely Teaching (domain, publications), Technical (skills), and Contract (period). Write a Java program to read and display at least 3 staff objects of all three categories.
Click Here
2. B. Write a Java class called Customer to store their name and date_of_birth. The date_of_birth format should be dd/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 “/”.
Click Here

Program 3
3.A. Write a Java program to read two integers a and b. Compute a/b and print, when b is not zero. Raise an exception when b is equal to zero.
Click Here
3.B. Write a Java program that implements a multi-thread application that hashtree 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.
Click Here

Program 4
4. 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.
Click Here

Program 5
5. 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 divideand-conquer method works along with its time complexity analysis: worst case, average case and best case.
Click Here

Program 6
6.A. Implement in Java, the 0/1 Knapsack problem using Dynamic Programming method.
Click Here
6.B. Implement in Java, the 0/1 Knapsack problem using Greedy method.
Click Here

Program 7
7. From a given vertex in a weighted connected graph, find shortest paths to other vertices using Dijkstra's algorithm. Write the program in Java.
Click Here

Program 8
8. Find Minimum Cost Spanning Tree of a given undirected graph using Kruskal's algorithm. Implement the program in Java language.
Click Here

Program 9
9. Find Minimum Cost Spanning Tree of a given undirected graph using Prim's algorithm. Implement the program in Java language.
Click Here

Program 10
10.A. Write Java program to Implement All-Pairs Shortest Paths problem using Floyd's algorithm.
Click Here
10.B. Travelling Sales Person problem using Dynamic programming.
Click Here

Program 11
11. Design and implement 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} and d= 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.
Click Here

Program 12
12. Design and implement the presence of Hamiltonian Cycle in an undirected Graph G of n vertices.
Click Here