You are on page 1of 13

Course Name- Design and

Analysis of Algorithms
Course Code- CSE 230
Continuous Assessment-I
Important Guidelines

1. Attempt any three questions out of 5.

2. It is mandatory to attempt all questions of the assignment in your own handwriting on A4


size sheets/pages with a blue color ink pen. Any other mode of attempt (typed or printed codes
or table) except handwritten/drawn will not be accepted/considered as valid submission(s)
under any circumstances.

3. Every attempted sheet/page should carry clear details of student such as Name, Registration
number, Roll number, Question number and Page number. The page numbers should be
written clearly on the bottom of every attempted sheet in a prescribed format as: for page 1;
Page 1 of 4, for page 2; Page 2 of 4, for page 3; Page 3 of 4 and for page 4; Page 4 of 4, in case
your assignment/document is of 4 pages.

4. After attempting the answer(s) file has to be submitted to Mr. Aman Kumar personally.

5. This PDF file should be uploaded onto the UMS interface on or before the last date of
the submission.

6. Refrain from indulging into plagiarism as copy cases will be marked zero.

7. This Document contains multiple sets of papers. The allocation sheet is also attached in
the CA file. All the students are advised to attempt the Set allocated to him/her.

8. If any student found indulge in malpractices like plagiarism from internet or


classmates, attempting wrong set of question paper or any other, will be awarded
with zero (0) marks in CA.
Design and Analysis of Algorithms(CSE-230) CA-1
Set-1
1. Explain the concept of Best Case, Average case and Worst Case of the given algorithm
below:

[10]
2. Explain which technique consecutively search the next value till it reaches the end of
element and the worst-case complexity is O(n), and apply on the given elements and search key
value=3
Input [1]: 1 5 2 7 3 4 8 6 [10]
3.Calculate and explain the complexity of binary search from its algorithm. [10]
4. Write a program to implement the concept of Divide and Conquer strategy by taking one
example. [10]
5. Write a program to implement the concept of Recursion using Tower of Hanoi. [10]
Design and Analysis of Algorithms(CSE-230) CA-1

Set-2
1. What are asymptotic Notations? How are notations playing an important role in Algorithms.
[10]
2. Explain which technique, the element is always searched in the middle of a portion of an
array and the worst-case complexity is O(log n). and apply on the given elements and search
key value=3
Input [1]: 1 3 5 6 7 9 11 15 16 [10]
3. Write a program to implement the concept of Divide and Conquer strategy by taking one
example [10]
4. Calculate and explain the complexity of linear search from its algorithm. [10]
5. Write a program to implement the concept of Fibonacci series using Recursion. [10]
Design and Analysis of Algorithms(CSE-230) CA-1
Set-3
1. Explain the concept of Best Case, Average case and Worst Case. Justify each with
Example. [10]
2. a) Write an algorithm for Binary Search. [5]
b) Do comparative analysis of Linear Search and Binary Search. [5]
3.The given sequence is [2,25,255,267,300,807]. Write a program and follow the most
optimized way to search an element (267) in the given sequence. [10]
4.Consider 3 towers (Source, Helper, Destination). Write a program to move 5 disks from
source tower to destination tower using Recursion only. [10]
5. Write a program to implement the concept of Fibonacci series using Recursion only. [10]
Design and Analysis of Algorithms(CSE-230) CA-1
Set-4

1. What is the Abstract Data Type explain in detail with examples.


[2]
2.i) In the worst case, the number of comparisons needed to search a singly linked list of length
n for a given element is. [1]

ii) Consider the following three functions.


f1 = 10n, f2 = nlogn, f3 = n√n
Which one of the following options arranges the functions in the increasing order of asymptotic
growth rate? [2]

3. Write a program to sort the Stack in Descending order using:


i) Temporary stack [10]
ii) Recursion
iii) Compare the time and Space Complexity between i) and ii)

4. Write a Program in java to demonstrate the concept of Recursion using Tower of Hanoi.
[10]

5. What would be the output of the following code? [5]


import java.1o.*

class Q

public static void swap(int x, int y)

int temp;

temp = x

y=X

y= temp;

System.out.print(x+" " + y);

public static void main(String[] args)

intx = 100;

int y= 10;
Swap(x, y);

6. Reverse a string using a stack. [10]

You are given a string and you have to print the reverse of the string using a stack.

Input Format
A string which has to be reversed.
Output Format
The reverse of the input string
Sample Input 1:
abcd
Sample Output 1:
dcba
Sample Input 2:
abcdef
Sample Output 2:
fedcba

7. Write a java program to find the square root of a number using a binary search. [10]
Design and Analysis of Algorithms(CSE-230) CA-1
Set-5

1.Answer the following from the code given below:


//Searches for a given value in a given array by sequential search
//Input: An array A[0..n − 1] and a search key K
//Output: The index of the first element in A that matches K
// or −1 if there are no matching elements
i←0
while i<n and A[i] = K do
i←i+1
if i<n return i
else return −1
i) Find the worst-case efficiency [2]
ii) Find the best-case efficiency [2]
iii) Find the average-case efficiency [1]
2. What are the complexity functions explain with examples. [10]
3. Explain the algorithms of
i)Bubble sort and give a suitable example. [10]
ii)Selection Sort and give a suitable example. [10]
4. Write a program to demonstrate linear Search and its java implementation. [10]
5.For each of the following algorithms, indicate (i) a natural size metric for its inputs, (ii) its
basic operation, and (iii) whether the basic operation count can be different for inputs of the
same size:
a. computing the sum of n numbers
b. computing n!
c. finding the largest element in a list of n numbers [5]
Design and Analysis of Algorithms(CSE-230) CA-1
Set-6
1. What are asymptotic Notations. How are notations playing an important role in
Algorithms. [10]
2. a) Justify the time complexity of Binary Search with example. [5]
b) Calculate the time complexity for the following case: [5]
void fun(int n){
for(i=1;i<n;i=i*2)
System.out.println(“The Time complexty is:”);
}
3. The given sequence is [901,708,1000,234,34,57]. Write a program and follow the most
optimized way to search an element (234) in the given sequence. [10]

4 Write a program to implement the concept of Divide and Conquer strategy by taking any 1
example. [10]
5. Complete the following function: [10]
public class Main
{
public static void Hanoi(int n, String src, String helper, String dest){

//Write your Code Here….


}
public static void main(String[] args) {
int n;
Scanner input= new Scanner(System.in);
System.out.println("Enter no of disks");
n=input.nextInt();
Hanoi(n,"S","H","D");
}
}
Student List with Assigned Sets

Registration
Sr. No Name of the Student Roll Number Set Allocation
Number

1 12112308 Shaik Ismail RK21PUA01 SET-1

2 12111390 Putha Siva Sai Shasank RK21PUA02 SET-2

3 12114833 Animireddy Bhargav Naidu RK21PUA03 SET-3

4 12115045 Madaka Tulasi Ram RK21PUA04 SET-4

5 12113723 Edupalli Sai Rakesh RK21PUA05 SET-5

6 12113729 K. Kishore Kumar RK21PUA06 SET-6

7 12113665 Pranshu Ranjan RK21PUA07 SET-1

8 12113162 Madhur Bansal RK21PUA08 SET-2

9 12112606 Abhishek Chaudhary RK21PUA09 SET-3

10 12107840 Kasukurthi Bhargav Sri Ram RK21PUA10 SET-4

11 12107835 Mallu Pardhiva RK21PUA11 SET-5

12 12107609 Muskan Raj RK21PUA12 SET-6

13 12105636 Varun Karotiya RK21PUA13 SET-1

14 12115288 Pulkit Narsaria RK21PUA14 SET-2

15 12115853 Syed Faiq Husain RK21PUA15 SET-3

16 12110177 Rakesh Kumar RK21PUA16 SET-4

17 12111471 Routhu Sai Sumanth RK21PUA17 SET-5

18 12115398 Rohan Patel RK21PUA18 SET-6

19 12115404 Palacharla Veera Vamsi RK21PUA19 SET-1

20 12116486 Madhan Sai Thupakula RK21PUA20 SET-2

21 12112968 Saladi Mohan Satish Kumar RK21PUA21 SET-3

22 12114663 Ayush Adiley RK21PUA22 SET-4


23 12114817 Nalla Purushotham Raj RK21PUA23 SET-5

24 12115106 Manoj Kanaka D H RK21PUA24 SET-6

25 12115135 Gummala Chandrakanth RK21PUA25 SET-1

26 12111526 Nalla Srija RK21PUA26 SET-2

27 12112093 Khurram Shahin RK21PUA27 SET-3

28 12112167 Velagandula Koushik RK21PUA28 SET-4

29 12112282 Palli Sai Kiran RK21PUA29 SET-5

30 12112920 Vullaganti Vijayendra Kumar RK21PUA30 SET-6

31 12113229 Gummudu Kishore Kumar RK21PUA31 SET-1

32 12113404 Aman Vishwakarma RK21PUA32 SET-2

33 12113985 Sajal Srivastava RK21PUA33 SET-3

34 12114271 Manchigarla Devadas RK21PUA34 SET-4

35 12114795 Rohit Kumar RK21PUA35 SET-5

36 12115164 Shaganti Ganesh RK21PUA36 SET-6

37 12115210 Rohan Stanislaus R RK21PUA37 SET-1

38 12005905 Manish Thakur RK21PUA74 SET-2

39 12115297 Komaturu Lavanya RK21PUB38 SET-3

40 12106435 Chanchal Alam RK21PUB40 SET-4

41 12107654 Reethu HV RK21PUB41 SET-5

42 12115013 Vaibhav Bansal RK21PUB42 SET-6

43 12115002 Aadhishwar P T RK21PUB43 SET-1

44 12114876 Tadi Tata Rao RK21PUB44 SET-2

45 12114879 Debasish Chandra Dey RK21PUB45 SET-3

46 12114807 Mannam Gnaneshwar RK21PUB46 SET-4

47 12114759 Om Kumar S Jha RK21PUB47 SET-5


Chirumamilla Kesava
SET-6
48 12114668 Manikanta Sai RK21PUB48

49 12114392 Kode Dhanush Sai RK21PUB49 SET-1

50 12114438 Bolleddula Eshwar Reddy RK21PUB50 SET-2

51 12112111 Bheemisetty Pavan Sai RK21PUB51 SET-3

52 12110133 Tauheed Prolta RK21PUB52 SET-4

53 12100335 Tolupunoori Rajshekar RK21PUB53 SET-5

54 12103257 Pothula Hari Sri Ram RK21PUB54 SET-6

55 12102424 Daksha Deep RK21PUB55 SET-1

56 12102387 Surakanti SrujanReddy RK21PUB56 SET-2

57 12102038 Bonagiri Ganga Pavan RK21PUB57 SET-3

58 12102041 Arra Sai Prashanth RK21PUB58 SET-4

59 12101918 Indukuri Satya Sudheer Varma RK21PUB59 SET-5

60 12101978 Vallaturu Subhash Naidu RK21PUB60 SET-6

61 12116676 Kartik Saxena RK21PUB61 SET-1

62 12100314 Bitra Hemanth RK21PUB62 SET-2

63 12102323 Prateek Kerketta RK21PUB63 SET-3

64 12115044 Balupunuri Kartheek Reddy RK21PUB64 SET-4

65 12115161 Mahrishi Rathore RK21PUB65 SET-5

66 12115261 Tarun Ambala RK21PUB66 SET-6

67 12111955 Rudrakshula Kanishk RK21PUB67 SET-1

Mallikarjuna Reddy
SET-2
68 12102343 Gopireddy RK21PUB68

69 12102363 Kaki Himanth RK21PUB69 SET-3

70 12103668 Gudimetla Shashank RK21PUB70 SET-4

71 12103857 RK21PUB71 SET-5


Mandavilli D V V Lakshmi
Pratap

72 12104776 Varala Enosh Reddy RK21PUB72 SET-6

73 12105013 Yanamala Sree Hari RK21PUB73 SET-1

74 12020794 Ayush Kumar Rai RK21PUB75 SET-2

You might also like