You are on page 1of 2

Design & Analysis of Algorithms --- List of Practicals

1. Write a program to implement following for an array: To insert a record in an array keeping in mind the exception of array is full. To delete an element from an array. To merge two arrays in one array. it should take care of the fact that if it is possible to merge in one of the available arrays or you require to create a new array. To split an array into two arrays. Splitting should be done based on odd & even numbers. To intersect two arrays into one array. To perform union of 2 arrays into 1 array. To increase size of an array. 2. Write an efficient program if given a positive integer number whether the given number is factorial of some other number or not? 3. Write an efficient program to find first n fibonacci numbers which are prime also. 4. Write an efficient program to find the reciprocal sums of factorials of first numbers. 5. Lucas number is defined to be sum of its two immediate previous terms. The first two lucas numbers are L0=2, L1=1. Find nth Lucas number. 6. Write an efficient program to convert a number from hexadecimal base to other bases. 7. Write an efficient program to find first n perfect numbers. 8. Write a program to do bitwise ANDing of two given binary numbers. 9. Write a program to implement following for a Linklist: To insert a record in an LL. To delete an element from a LL. To merge two LL in one LL. To intersect two LL into one LL. To perform union of 2 LL into 1 LL 10. Write an algorithm for checking that whether a given word is an anagram of another word. The word should have same length and same frequency of each letter occurring in the original word. Letters can be repeated within a word. 11. Imagine four railroad cars positioned on the input side of the track numbered 1,2,3,4 respectively. Suppose we perform the following operations: move car 1 into stack, move 2 into stack, move 2 out, move 3 into stack, move 4 into stack, move 4 out, move 3 out, move 1 out. As a result the original order has been changed from 1234 to 2431. What permutations of the number 1,2,3,4 are possible that can be get using the above method? Input that permutation and get the output as yes or no indicating it is possible or not. First Number gives number of permutations. Input File

2 3241,3142 Output File 1,0 12. An evil king has a cellar containing n bottles of expensive wine, and his guards have just caught a spy trying to poison the kings wine. Fortunately, the guards caught the spy after he succeeded in poisoning only one bottle. Unfortunately they dont know which one. To make the matter worse the poison the spy used was very deadly. Just one drop diluted even to a billion will still kill someone. Even so, the poison works slowly. It takes a full month for the person to die. Design a scheme that allows the evil king to determine exactly which one of his wine bottles was poisoned in just one months time while expending at most O(logn) of his taste testers. First integer gives number of bottles and the sequence gives the number of taste testers who died. Input File 1000 1,3,6 Output File 656

You might also like