Skip to content

infiniteoverflow/VTU-DAA-LAB

Repository files navigation

VTU-DAA-LAB

This repository contains all the programs of the Design and Analysis of Algorithm Lab for the 2017 Scheme

1A - Student.java

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 USN,Name,Branch and Phone of these objects with suitable headings.

CODE : https://github.com/infiniteoverflow/VTU-DAA-LAB/blob/master/Student.java


1B - Stack.java

Write a Java Program to implement the stack using arrays. Write Push() , Pop() , and display() methods to demonstrate its working.

CODE : https://github.com/infiniteoverflow/VTU-DAA-LAB/blob/master/Stack.java


2A - Inheritance.java

Design a superclass called Staff with details as StaffId,Name,Phone and Salary. Extend this class by writing three subclasses namely Teaching(domain,publication) , Technical(staff) and Contract(period). Write a Java Program to read and display atleast 3 staff objects of all three categories.

CODE : https://github.com/infiniteoverflow/VTU-DAA-LAB/blob/master/Inheritance.java


2B - StringTokeniser.java

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 "/"

CODE : https://github.com/infiniteoverflow/VTU-DAA-LAB/blob/master/StringTokeniser.java


3A - Exception.java

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.

CODE : https://github.com/infiniteoverflow/VTU-DAA-LAB/blob/master/Exception.java


3B - MultiThreading.java

Write a Java program that implements a multi-thread application that has three threads. First Thread generates a random number 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.

CODE : https://github.com/infiniteoverflow/VTU-DAA-LAB/blob/master/MultiThreading.java


4 - QuickSort.java

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.

CODE : https://github.com/infiniteoverflow/VTU-DAA-LAB/blob/master/Quicksort.java


5 - MergeSort.java

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.

CODE : https://github.com/infiniteoverflow/VTU-DAA-LAB/blob/master/Mergesort.java


6A - KnapsackA.java

Implement in Java, the 0/1 Knapsack problem using Dynamic Programming

CODE : https://github.com/infiniteoverflow/VTU-DAA-LAB/blob/master/KnapsackA.java


6B - KnapsackB.java

Implement in Java , the 0/1 Knapsack problem using Greedy method

CODE : https://github.com/infiniteoverflow/VTU-DAA-LAB/blob/master/KnapsackB.java


7 - Djikstra.java

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

CODE : https://github.com/infiniteoverflow/VTU-DAA-LAB/blob/master/Dijkstra.java


8 - Kruskal.java

Find Minimum Cost Spanning Tree of a given connected undirected graph using Kruskal's algorithm. Use Union-Find algorithms in your program.

CODE : https://github.com/infiniteoverflow/VTU-DAA-LAB/blob/master/Kruskal.java


9 - Prims.java

Find Minimum Cost Spanning Tree of a given connected undirected graph using Prim's algorithm.

CODE : https://github.com/infiniteoverflow/VTU-DAA-LAB/blob/master/Prims.java


10A - Floyds.java

Write Java program to implement All-Pairs Shortest Paths problem using Floyd's algorithm

CODE : https://github.com/infiniteoverflow/VTU-DAA-LAB/blob/master/Floyds.java


10B - TSP.java

Write a Java program to implement Travelling Salesman Problem(TSP)

CODE : https://github.com/infiniteoverflow/VTU-DAA-LAB/blob/master/TSP.java


11 - Subset.java

Design and implement in Java to find a subset of a given set S = {s1,s2,...,sn} of n positive integers whose SUM is equal to a given positive integer d. Display a suitable message , if the given problem instance dosent have a solution.

CODE : https://github.com/infiniteoverflow/VTU-DAA-LAB/blob/master/Subset.java


12 - Hamiltonian.java

Design and implement in Java to find all Hamiltonian Cycles in a connected undirected graph G of n vertices using backtracking principal

CODE : https://github.com/infiniteoverflow/VTU-DAA-LAB/blob/master/Hamiltonian.java


About

This repository contains all the programs of the Design and Analysis of Algorithm Lab for the 2017 Scheme

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages