PROFILE PORTFOLIO MY WORKS Contact

MCES
DAA

DAA LAB


1a. 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.


1b. Write a Java Program to implement the Stack using arrays. Write Push(), Pop) and Display() methods to demonstrate its working.


2a. Design a super class called Staff with details as Staffld, 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.


2b. Write methods to read customer data as and display as using String Tokenizer class considering the delimiter character as """


3a. Write a Java program to read two integers a and b Compute a/b and print, when b is not zero. Raise an when b is equal to zero.


3b. Write a Java program that implements a multi-thread application that has three threads. The first thread. generates a random integer for every 1 second; the second thread computes the square of the number and prints, the third thread will print the value of cube of the number.


4. Sort a given set of n integer elements using Quick Sort method and compute its time complexity. Run the program for 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 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.
OUTPUT: enter size of the array 10 the elements of the array 33 55 15 47 36 54 59 77 98 52Time taken 0 15 33 36 47 52 54 55 59 77 98 Time taken 0 Process finished.


5. Sort a given set of n integer elements using Merge Sort method and compute its time complexity. Run the 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.


6. Implement in Java, the 0/1 Knapsack problem using (a) Dynamic Programming method (b)Greedy method.
<-- 6b -->


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


8. Find Minimum Cost Spanning Tree of a given undirected graph using 7 8 (a) Kruskai's algorithm (b) Prim's algorithm. Implement the program in Java language.


9. Write Java programs to implement (a) All-Pairs Shortest Paths problem using Floyd's algorithm (b) Travelling Sales Person problem using Dynamic programming.