Professional Documents
Culture Documents
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.
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();
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
Registration
Sr. No Name of the Student Roll Number Set Allocation
Number