Sunteți pe pagina 1din 7

CHANDIGARH UNIVERSITY

Gharuan, Mohali
Institute/Department: CSE
Division:BE
Subject Name: Design and Analysis of Algorithms
Subject Code: CST-302

Assignment No.: 1
Max. Marks: 12

Date of Allotment:16th Aug, 2019


Last date of Submission:16th Sep, 2019

Course Outcomes:
CO Title Level
Number

CO1 Designing and analyzing algorithms, Time and Space Practice


complexity, Asymptotic notations,

CO2 Recurrence equations and their solution Practice

CO3 Review of Data Structures, Hashing, Trees, Heaps, Graphs Practice


and Sets

CO4 Sorting algorithms Practice


Assignment :1

Sr. No. Question CO


Number

1 Q1:- Calculate the complexity for the code: CO1


Void fun()
{

For(i=0;i<n;i++)

For(j=1;j<n;j++)

Count++ ;

2 Q2:- If n is any number then what will be the minimum CO2


number of comparisons needed to check that n is a prime
number or not?
3 CO2
Q3:- Describe the working of divide and conquer technique with
example.
4 Q4:- Name three conditions under which sequential search is CO3
preferable to binary search.

Assignment :2

Sr. No. Question CO


Number

1 Q1:- Arrange the following growth rates in increasing order: CO1

O(n4), O(1), O(n3), O(n), O(n logn), O(n2 logn)

2 Q2:- The worst case time complexity of quick sort is O(n2). Why so? Explain CO1
mathematically.

3 Q3:- Write algorithm for implementation of stacks using linked list. CO3

4 Q4:- . Sort the array using Merge Sort. CO4

12,56,88,11,2,12,96,32,,44,49,53,12,15
Assignment :3

Sr. Question CO
No. Number

1 Q1:- Find the product of 2 Matrices using Strassen’s Method. CO1

23 5 4 1 2 3 4
42 1 3 2 4 2 4
61 2 5 1 1 1 2
85 1 2 3 2 1 2
2 Q2:- Give the algorithm for matrix multiplication and find the time CO1
complexity of the algorithm using step – count method.
3 CO1
Q3:- Differentiate between Big O and omega notation with example.
4 Q4:- Write Divide – And – Conquer recursive Merge sort algorithm and CO3
derive the time complexity of this algorithm.

Assignment :4

Sr. Question CO
No. Number

Q1:- Give the algorithm for Quick Sort and check whether it’s a stable CO4
sort or not.
Q2:- Give the plan for analyzing the time efficiency of non-recursive CO2
algorithms.
Q3:- What is a linear search algorithm? Analyze it in terms of time and space CO3
complexity.

Q4:- a) Write and explain recursive binary CO3

search algorithm.

b) Derive the time complexity of merge sort.


Assignment :5

Sr. Question CO
No. Number

1 Q1:- What are the characteristics of an algorithm? Explain about Branch CO1
and Bound method.
2 Q2:- In terms of the big-O notation, compare the difference in time CO1
required for table lookup and for list searching.
3 Q3:- Differentiate between tree & graph. CO3

4 Q4:- Compare quick-sort with insertion-sort. CO4

Assignment :6

Sr. Question CO
No. Number

1 Q1:- Define Stack and Queue. What are the operations that can be done on a CO2
stack?

2 Q2:- State the Euclid’s algorithm for finding GCD of two given numbers. CO2

3 Q3:- What are the 3 parts of the algorithm? Why do we need algorithm CO1
analysis?
4 Q4:- What do you mean by “Amortized efficiency”? How to measure the CO1
algorithm’s efficiency?

Assignment :7

Sr. Question CO
No. Number

1 Q1:- Prove that 100n+5 O (n2)? CO1

2 Q2:- Find the number of comparisons made by the sequential search in the CO2
worst case and best case.

3 CO2
Q3:- Define control abstraction. Write the Control abstraction for Divide-
and conquer.
4 Q4:- Discuss Sum of subset problem. CO2
Assignment :8

Sr. Question CO
No. Number

1 Q1. Infix to postfix conversion : 6+8*4/2 CO2

2 Q2. Differentiate between stack and array? CO2

3 Q3. What is iterative algorithm? CO2

4 Q4. Write an algorithm to find height of BT ? CO4

Assignment :9

Sr. Question CO
No. Number

1 Q1.Perform insertion and deletion in binary tree using level order CO2
traversal and do the complexity analysis for the same.

2 CO3
Q2. Write a short note about AVL trees?

3 Q3.Write an algorithm to find height of BST ? C03

4 Q4. Write an algorithm for insertion and deletion in a queue? CO3

Assignment :10

Sr. Question CO
No. Number

1 Q1. Write an algorithm to find a cycle in linked list? CO2

2 Q2.Write a short note on circular linked list? CO2

3 Q3. Let G be a connected undirected graph. Write an algorithm to find CO3


the minimum number of edges that have to be added to G so that G
becomes bi-connected. Your algorithm should output such a set of
edges. What are time and space requirement of your algorithm.
4 Q4. Use Radix sort and sort given list in ascending order: CO4

38,43,720,5437,56,52

Assignment :11

Sr. Question CO
No. Number

1 Q1. Solve given equation using recursive tree method: CO2

T(n) = 8Tn/2)+n2 if n>1

2 Q2. Write a short note on queues? CO3

3 Q3. Write a short note on B+ trees? CO3

4 Q4. Give computing time for linear search? CO2

Assignment :12

Sr. Question CO
No. Number

1 Q1. Construct max and min heap for : 9,1,8,6,4,5,3,2,11,21 CO3

2 Q2. Write an algorithm to find maximum element from right sub tree and CO3
minimum element from left sub tree from BST?

3 CO2
Q3. What do you understand by the term pseudo code?

4 Q4. Write recursive algorithm for Fibonacci series ? CO4

S-ar putea să vă placă și