assignment i

3
Assignment 1 (Based on Unit-I) Analysis and Design of Algorithms Q1. Define algorithm.Describe its various characteristics. Q2. A recurrence T (n) =7T(n/2)+ n 2 describe running time of an algorithm A1. A competing algorithm A2 has running time of T`(n)=a T` (n/4) + n 2 .What is largest integer value of ‘a’ such that A2 is asymptotically faster than A1. Q3. Apply quicksort to sort the list E, X, A, M, P, L , E in alphabetical order , draw the tree of the recursive calls made. Q4. What is the worst-case running time for the bucket sort algorithm and explain the order of data set. Q5. Describe the insertion sort algorithm and analyze its time complexity. Q6. Illustrate recurrence tree for the recurrence T(n) = 2 T ( n / 2) + n 2 . Q7. Show that MERGE SORT algorithm follows divide and conquer paradigm. Q8. Explain Heapsort and write algorithm for heapsort and find out the time complexity of that algorithm.

Upload: vaibhav-sharma

Post on 23-Nov-2014

154 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Assignment I

Assignment 1 (Based on Unit-I)

Analysis and Design of Algorithms

Q1. Define algorithm.Describe its various characteristics.

Q2. A recurrence T (n) =7T(n/2)+ n2 describe running time of an algorithm A1. A

competing algorithm A2 has running time of T`(n)=a T` (n/4) + n2 .What is largest

integer value of ‘a’ such that A2 is asymptotically faster than A1.

Q3. Apply quicksort to sort the list

E, X, A, M, P, L , E in alphabetical order , draw the tree of the recursive calls

made.

Q4. What is the worst-case running time for the bucket sort algorithm and explain the

order of data set.

Q5. Describe the insertion sort algorithm and analyze its time complexity.

Q6. Illustrate recurrence tree for the recurrence T(n) = 2 T ( n / 2) + n2 .

Q7. Show that MERGE SORT algorithm follows divide and conquer paradigm.

Q8. Explain Heapsort and write algorithm for heapsort and find out the time

complexity of that algorithm.

Q9. Write a short notation on asymptotic notation.

Q10. What is time complexity? Analyze time complexity of Fibonacci number

algorithm.

Q11. What is the time complexity of counting sort? Sort 1, 9, 3, 3, 4, 5, 6, 7, 7, 8 by

counting sort.

Q12. Draw recursion tree for T(n)=4T(n/2)+cn where c is a constant and provide a

tight asymptotic bound on its solution.

Q13. Using the master method, give tight asymptotic bounds for the following

recurrences:

Page 2: Assignment I

a) T(n) = 4T(n/2) + n

b) T(n) = 4T(n/2) + n2

c) T(n) = 4T(n/2) + n3

Q14. Write down recurrence relation in the formula form for divide and conquer

algorithm.

Q15. Given f(n)= log n, g(n)=n1/2. Show which function is asymptotically faster?

Q16. Explain why the statement “The running time of algorithm A is at least O (n2)”

is meaningless.

Q17. Explain Heap sort algorithm through diagrams.

Q18. For example, consider an array of elements. Now explain the working of

partition function in Quick sort algorithm.

Q19. Using figure as a model, illustrate the operation of Heap sort on the array

A=<6,14,3,25,2,10,20,7,6>

Q20. Write an algorithm of Quick sort and find the time and space complexity.