Está en la página 1de 6

ANNA UNIVERSITY: CHENNAI 600025 MCA DEGREE EXAMINATIONS MAY/JUNE-2012 Second Semester MC9229: ALGORITHMS LAB

(REGULATIONS 2009) Time: 3 Hrs. 1. Maximum Marks: 100

Write a program to get the following details of n employees: Id, Name, Gender, 100 Department, Designation, Basic Pay, Grade Pay, DA, HRA, CA, MA and Gross Pay. Assume that Id, Name, Gender, Department, Designation, Basic Pay, Grade Pay, CA, and MA are stored attributes and DA, HRA, and Gross Pay are derived attributes. Store the employee details in the order in which it is read from the user and display them. Sort the details based on the gross salary, using Quicksort algorithm and display them. Note: DA: 11% of (Basic Pay + Grade Pay) HRA: if (Basic Pay < 18000), HRA = 3000, else HRA = 5000 Gross Pay: Sum of Basic Pay, Grade Pay, DA, HRA, CA, MA

2.

Write a program to get the following details of n students: Roll No, Name, 100 Marks in 5 theory courses, each with a credit of 3, and 3 lab courses, each with a credit of 2. Find the GPA of each student. Store the student details in the order in which it is read from the user and display them. Sort the student details using Quicksort algorithm and assign ranks to the students. Display the student details in sorted form. Note:

GPA =

GradePo int Credit Credit


i i i i

, i represents the courses 1,2,3 8

where GradePo int

10, 9, 8, 7, 6, 5,

if mark 90 if 80 mark < 90 if 70 mark < 80 if 60 mark < 70 if 55 mark < 60 if 50 mark < 55

Do not compute the GPA if a student has secured < 50 marks in any subject and hence do not add the student in the rank list.

3.

Write a program to store the following details of n books in random order: 100 Title, Author Name, Publisher, No. of copies issued, and No. of copies available. Store them and search for a book, given the book title, using Binary Search Algorithm. Retrieve all the details of the book searched for.

4.

Write a program to get the following details of n students: Admission no., 100 name, gender, date of birth, date of admission. Using Binary Search algorithm, sort them in ascending order of names and assign Roll No to the students. Modify the algorithm to insert a new student in the sorted list so that the modified list is still sorted with the self-adjusted roll no.

5.

Write a program to read a set of numbers and construct a binary tree. Write 100 subroutines to perform various binary tree traversals and test them.

6.

Write a program to read an expression tree as input and traverse the tree to get 100 the corresponding infix, prefix, and postfix expressions.

7.

Represent a graph using adjacency matrix. Write a program to find the shortest 100 path using Warshalls algorithm.

8.

Represent a graph using adjacency matrix. Write a program to find the shortest 100 path using Dijkstras algorithm.

9.

Represent a graph using adjacency list. Write a program to find the shortest 100 path using Warshalls algorithm.

10. Represent a graph using adjacency list. Write a program to find the shortest 100 path using Dijkstras algorithm.

11. Represent a graph using adjacency matrix. Write a program to determine the 100 minimum spanning tree using Prims algorithm.

12. Represent a graph using adjacency list. Write a program to determine the 100 minimum spanning tree using Prims algorithm.

13. Write a program to solve the following Knapsack Problem: You are given a set 100 of integers A = {a1, a2, , aN} and an integer K. Is there a subset of A sum is exactly K.

14. Write a program to solve the following problem: You are given a currency 100 system with coins of (decreasing) value c1, c2, , cN. Write a program that computes the minimum number of coins required to give K cents in change.

15. Consider the problem of placing eight queens on an (8x8) chess board. Two 100 queens are said to attack each other if they are on the same row, column or diagonal. Write a program using Backtracking algorithm to place 8 non-attacking queens on the board.

16. Write a program to solve the following problem: You have a set of n integers 100 each in the range 0 ... K. Partition these integers into two subsets such that you minimize |S1 - S2|, where S1 and S2 denote the sums of the elements in each of the two subsets.

17. Write a program to solve the following problem: You are given an ordered 100 sequence of n cities, and the distances between every pair of cities. You must partition the cities into two subsequences (not necessarily contiguous) such that person A visits all cities in the first subsequence (in order), person B visits all cities in the second subsequence (in order), and such that the sum of the total distances travelled by A and B is minimized. Assume that person A and person B start initially at the first city in their respective subsequences.

18. Write a program to solve the following problem using branch and bound: Given 100 a list of cities and their pairwise distances, find the shortest possible route that visits each city exactly once and returns to the origin city.

19. Write a program to solve the following problem using dynamic programming: 100 Given a list of cities and their pairwise distances, find the shortest possible route that visits each city exactly once and returns to the origin city.

20. Write a program to multiply two given matrices using strassens matrix 100 multiplication algorithm.

Mark Distribution Aim 5 Algorithm 25 Program 30 Expected Output 10 Output 20 Viva 10 Total 100

También podría gustarte