0% found this document useful (0 votes)
12 views

ADA Assignment 1 Unit 1

The document outlines the assignment details for the B. Tech (CSE) program, specifically for the Analysis and Design of Algorithm course. It includes instructions for submission, evaluation criteria, and a list of questions covering various algorithmic concepts and complexities. The assignment contributes to 10% of the internal evaluation and prohibits the use of AI tools like ChatGPT.

Uploaded by

spandan1106
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

ADA Assignment 1 Unit 1

The document outlines the assignment details for the B. Tech (CSE) program, specifically for the Analysis and Design of Algorithm course. It includes instructions for submission, evaluation criteria, and a list of questions covering various algorithmic concepts and complexities. The assignment contributes to 10% of the internal evaluation and prohibits the use of AI tools like ChatGPT.

Uploaded by

spandan1106
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

School of Engineering & Technology

Department: SOET Session: 2024-25

Program: B. Tech (CSE) Semester: 4

Course Code: ETCS202 Number of students: 63

Course Name: Analysis and Design Faculty: Dr. Swati


of Algorithm

Instructions:

 Assignment needs to be submitted by given date.


 Assignment must be submitted on https://lms.krmangalam.edu.in/
 Use of ChatGPT and similar tools is strictly prohibited.
 Assignment needs to be submitted by each individual.
 This assignment contributes to total 10% of internal evaluation
 Assignments will be evaluated on the basis on correctness and completeness of question.

S. No. Questions CO’s

1. A new game in the App store called AmazeMe involves finding a path out of an n- CO1
dimensional maze. The authors of the game claim there is a solution with worst case
complexity O(n4 log n). where n is the number of dimensions.
From this, we can conclude that:

a. For every sufficiently large n, every input maze of dimension n requires time
proportional to n4 log n.
b. For every sufficiently large n, every input maze of dimension n can be solved
within time proportional to n4 log n.
c. For every sufficiently large n, there is an input maze of size n that requires
time proportional to n4 log n.
d. For some n, every input maze of size n requires time proportional to n4 log n.
2. We have 8 sorted lists, each of length n. We need to merge them into a single sorted CO1
list. We merge them in pairs to get 4 sorted lists of length 2n, then 2 sorted lists of
length 4n and finally 1 sorted list of length 8n. What is the complexity of this
procedure?

What is step count method? Compute the complexity of the following algorithm
using step count

1. int mean(int a[], int n)

2. {

3. int sum = 0;
4. for (int i = 0; i < n; i++)

5. sum += a[i];

6. return sum;

7. }

3 Compute the complexity of the following algorithm using step count CO1

for i in 1..n loop

for j in 1..n loop

if i < j then

swap (a(i,j), a(j,i));

end if;
4 Explain different methods to solve recurrences relation

5. For each of the following recurrences, give an expression for the runtime T (n) if the CO2
recurrence can be solved with the Master Theorem. Otherwise, indicate that the
Master Theorem does not apply.

a) T (n) = 3T (n/2) + n 2, T(0)=1


b) T (n) = 2T (n/2) + n log n, T(0)=1

5 Consider T(n) = T(n/3) + T(2n/3) + cn CO2

Solve

a) Using a recursion tree

b) Verify the above solution with the substitution method

6 What is insertion sort? Sort the following numbers in increasing order using insertion CO1
sort 5 2 4 6 1 3.

Analyze the time complexity for best case, average case and worst case.

7 Solve the following recurrence using recursion tree CO1

T(n) = 3T(n/4) + Θ(n2 )

8 Solve the following recurrence using recursion tree CO3

T(n) = 2T(n/2) + n
9. Solve the following questions using Master Theorem: CO1

1. T (n) = 3T (n/2) + n2

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

3. T (n) = T (n/2) + 2n

4. T (n) = 2nT (n/2) + nn

5. T (n) = 16T (n/4) + n

6. 6. T (n) = 2T (n/2) + n log n

10. Write an algorithm to find the maximum element in an array of n elements. Give the CO2

mathematical analysis of this non recursive algorithm

You might also like