You are on page 1of 12

Course Name- Data Structures

Course Code- CSE 228


Continuous Assessment-I
Important Guidelines

1. All questions in this Academic Task are compulsory.

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) single pdf format document (can be done with many free
online available converters).

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.
Data Structures (CSE-228) CA-1
Set-1
1. Is Queue a Linear Data Structures, explain with an example, and differentiate with Non-
linear Data Structures.
[10]

2. Description: You are given a stack with n integers and you need to push an element at second
from the bottom of the stack.
Input: 1 2 3 4 5 6 7 Output: 1 8 2 3 4 5 6 7
[10]
3. a) Explain Big O Notation, and Big Omega which of these represents the upper bound.
[5]
b) Linked lists are not suitable data structures for the following problems. Explain why?
a) Insertion sort b) Binary Search c) Radix Sort
[5]
4. Write a program to implement stack push and pop operation using Queue.
[10]
5. Write a java code to solve the parenthesis matching problem using stack.
[10]
Data Structures (CSE-228) CA-1
Set-2

1. Why Stack is not Non-Linear Data Structure, compare it with Non-Linear Data Structures?
[10]
2. a) Explain Big Theta and Big Omega. Out of these two which one is the subset of the other
[5]
b) Linked lists are not suitable data structures for the following problems. Explain why?
a) Polynomial Manipulation b) Binary Search c) Radix Sort
[5]
3. Description: You are given a stack with n integers and you need to delete elements from the
bottom of the stack.
Input: 1 2 3 4 5 6 7 Output: 2 3 4 5 6 7
[10]
4 Write a java code to perform Push, Pop, Search and Peek operation on the stack.
[10]
5. Write a program to implement use of offer(), add(), poll() and remove() in Queue
[10]
Data Structures (CSE-228) CA-1
Set-3
1.i) Consider the following array.

33 56 45 69 72 3 9 97

Which algorithm uses the least number of comparisons (among the array elements) to sort above
array in descending order?
[5]
ii) The worst-case running times of Insertion sort, Merge sort and Quick sort, respectively.
[3]
iii) Consider the following array of elements.
〈89,19,50,17,12,15,2,5,7,11,6,9,100〉
The minimum number of interchanges needed to convert it into a max-heap is?
[5]
iv) A function f defined on stacks of integers satisfies the following properties. f(∅) = 0 and f
(push (S, i)) = max (f(S), 0) + i for all stacks S and integers i. If a stack S contains the integers
2, 3, 2, 1, 12 in order from bottom to top, what is f(S)?
[5]
v) Consider the following sequence of operations on an empty stack.
push(54); push(52); pop(); push(55); push(62); s = pop();
Consider the following sequence of operations on an empty queue.
enqueue(21); enqueue(24); dequeue(); enqueue(28); enqueue(32); q = dequeue();

The value of s + q is ______


[2]

2.What is a static keyword in java? Explain the Difference between static and final keyword with
an example.
[10]
3.Write a program to Reverse a Stack using Recursion.
[10]
4.Write a Program to print the second element from the top of the stack containing n elements.
[10]
Sample Input:
5
12345
Sample Output:
4
Data Structures (CSE-228) CA-1
Set-4

1.i) Would it make sense to call a queue.


a. a LILO structure?
b. a FILO structure? [5]
ii)What are the advantages and disadvantages of the linked implementation of a queue relative
to the contiguous implementation? [5]
2.i) Let T(n) be the worst-case time taken by max with second argument n. That is, n is the
number of elements of which the largest is found. Write an equation expressing T(n) in terms of
T(j) for one or more values of j less than n and a constant or constants that represent the times
taken by individual statements of the max program. [5]
ii)Give a tight big oh upper bound on T(n). Your answer should be equal to the big omega lower
bound and be as simple as possible. [5]
3.Explain the difference between the output from
String s;
System.out.println("s = " + s);
and the output from
String s = new String();
System.out.println("s = " + s); [5]
4.Two consecutive odd integers that are both prime are called twin primes. The twin primes
conjecture is that there are infinitely many twin primes. Write a program that finds all the twin
primes that are less than 1000. Your first five lines of output should look like this: [5]
35
57
11 13
17 19
29 31
5.Implement a Stack using Queue data structure. [10]
6.Write a program to find the missing number in an integer array of 1 to 100? [10]
Data Structures (CSE-228) CA-1
Set-5
1. What is Linear Data Structures. Explain with example (min 2 examples). [10]
2. a) Explain Big O Notation, Big Omega. [5]
b) Big O Case- Consider the given equations f(n)=3n^2+2n+1, g(n)= 7n. Calculate the value
of C, considering n=1. [5]
3.Consider the given sequence as an input of stack: 8,2,9,4,5,6 where first element is 8 and top
element is 6. Read the element “4” and return its location. [10]
4. Write a program to sort a stack using recursion. [10]
5. Write a program to implement Queue Data Structure while performing enqueue and dequeue
operation. [10]
Data Structures (CSE-228) CA-1
Set-6
1. Explain Non-Linear Data Structure by taking minimum 2 examples. [10]
2. a) Explain Big Theta and Big Omega. [5]
b) Big Omega Case- Consider the given equations f(n)=3n^2+2n+1, g(n)= 7n^4. Calculate the
value of C, considering n=1. [5]
3. Write a program to replace the value present at middle of the stack with some new value.
Check the case below:
Input: 2,7,8,1,5 Output: 2,7,57,1,5 [10]
4 Write a program to perform Push, Pop and Peek operation on the stack. [10]
5. Write a program to reverse the Queue using Recursion. [10]
Student List with Assigned Sets

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

1 12109812 Javvadi Jaswant Sri Akhilesh RK21MDA01 SET-1

2 12109458 V Akshay Sai RK21MDA02 SET-2

3 12107884 Vaspari Murari RK21MDA03 SET-3

4 12107709 Sonal Kumari RK21MDA04 SET-4

5 12105513 Ankit Siwach RK21MDA05 SET-5

6 12107073 Garadala Mokshith Sai RK21MDA06 SET-6

7 12107196 Deepanshu RK21MDA07 SET-1

8 12106564 R Rajasree Singh RK21MDA08 SET-2

9 12106386 Pentyala Kumar Govindu RK21MDA09 SET-3

10 12112489 Nuni V Vijay Sai RK21MDA10 SET-4

11 12111519 Maddipatla Durga Prasad RK21MDA11 SET-5

12 12111396 Darsi Venkat Charan RK21MDA12 SET-6

13 12111711 Kunal Kumar Pandit RK21MDA13 SET-1

14 12111702 Manish Choudhury RK21MDA14 SET-2

15 12111916 Hanumantha Rao Vadlamudi RK21MDA15 SET-3

Nandanavanam Nitya Sri


16 12101827 RK21MDA16 SET-4
Santoshini

17 12104789 Alla Pavan Venkata Sivaji RK21MDA17 SET-5

18 12104754 Achanagari Hanu Tejesh RK21MDA18 SET-6

19 12104771 Jakkilinki Heshith RK21MDA19 SET-1

20 12106640 Seema RK21MDA20 SET-2

21 12106729 Kriti Mishra RK21MDA21 SET-3

22 12111443 Rajesh Palavalasa RK21MDA22 SET-4


23 12111532 Susnata Das Mahapatra RK21MDA23 SET-5

24 12111835 Mallekedi Shrivardhan RK21MDA24 SET-6

25 12111838 Mallekedi Vamshi RK21MDA25 SET-1

26 12110713 Somesh Verma RK21MDA26 SET-2

27 12109817 Pichala Naveen Reddy RK21MDA27 SET-3

28 12103382 Acchannagari Saaii RK21MDA28 SET-4

29 12104879 Jarugu Mukesh Sai RK21MDA29 SET-5

30 12105351 Sujeet Kumar Behera RK21MDA30 SET-6

31 12106470 Lanka Srinivasudu RK21MDA31 SET-1

32 12107544 Shaik Latheef RK21MDA32 SET-2

Amudala Vishnu Koushik


33 12107767 RK21MDA33 SET-3
Reddy

34 12109785 Inturi Sukumar RK21MDA34 SET-4

35 12111860 Chettupalli Rohan Apuroop RK21MDA35 SET-5

36 12112467 Devarapu Akhil Chowdary RK21MDA36 SET-6

37 12111599 Badugu Naveen Babu RK21MDB37 SET-1

38 12111353 Abhijit Gidhade RK21MDB38 SET-2

39 12111585 Darsh Saxena RK21MDB39 SET-3

40 12112337 Y Sai Preetham RK21MDB40 SET-4

41 12110554 Shaik Julfeen Ahmadh RK21MDB41 SET-5

42 12110562 Vaddepally Akhilesh RK21MDB42 SET-6

43 12110600 Santhosh Kumar S RK21MDB43 SET-1

44 12110846 Chilla Jagadesh RK21MDB44 SET-2

45 12110943 Shristi Sehwag RK21MDB45 SET-3

Kamuju Shyam Satya


46 12111001 RK21MDB46 SET-4
Manikanta Pavan
Gorlamari Srujan Kumar
47 12111003 RK21MDB47 SET-5
Reddy

48 12111112 Rahul Boddu RK21MDB48 SET-6

49 12111298 Uppada Satwik RK21MDB49 SET-1

50 12113102 Annamdevula Ravi RK21MDB50 SET-2

51 12112870 Ambati Dileep Kumar Reddy RK21MDB51 SET-3

52 12113391 Tanish Dogra RK21MDB52 SET-4

53 12113296 Surya Pratap Singh RK21MDB53 SET-5

54 12107331 Chigicherla Thati Reddy RK21MDB54 SET-6

55 12107798 Achanta Nikith Chowdary RK21MDB55 SET-1

56 12109994 Priyanshu Singh RK21MDB56 SET-2

57 12110486 Jaggumantri Charan RK21MDB57 SET-3

58 12110944 Waseem RK21MDB58 SET-4

59 12111371 Shaik Abdul Rasheed RK21MDB59 SET-5

Kanigelupula Surya Venkata


60 12107624 RK21MDB60 SET-6
Phanindra

61 12106502 Akula Kowshik Manikanta RK21MDB61 SET-1

62 12110324 Produturu Prathap Reddy RK21MDB62 SET-2

63 12110656 Mythili Rampuram RK21MDB63 SET-3

64 12111005 Koppula Jaya Vardhan Reddy RK21MDB64 SET-4

65 12111200 K Ranjith Kumar Reddy RK21MDB66 SET-5

66 12112064 Kota Venkat Sandeep Reddy RK21MDB67 SET-6

67 12112090 Aravind Kontham RK21MDB68 SET-1

68 12107367 Shivansh Ranjan RK21MDB69 SET-2

69 12107570 Saurabh Chandra RK21MDB70 SET-3

70 12107693 Manjusha Singh Yadav RK21MDB71 SET-4


71 12109308 Simran Rathor RK21MDB72 SET-5

72 12106517 Lakshya Choudhary RK21MDB73 SET-6

You might also like