You are on page 1of 3

SCHOOL OF INFORMATION TECHNOLOGY AND ENGINEERING

M.Tech. Software Engineering (Integrated) - Winter 2019-20

DIGITAL ASSIGNMENT – I

Questions:
1) Let S represent an instance of the Stack ADT. Let S.push(x) push the value x on to the
top of the stack, S.pop() remove the topmost element from the stack and return the value.
Consider the following sequence of operations performed on S which initially contains 10
elements with 55 as the top most element (Assume that S is of sufficient capacity).
S.push (7);
S.push (20);
S.push (35);
S.pop ();
S.push (14);
S.pop ();
S.pop ();

What will be the element at the top of the stack after the above sequence of operations?
2) Consider the method for conversion of an infix expression to its prefix form using stack
as discussed in lecture. What will be the second last operator that gets popped off the stack by
the end of conversion of the following expression using this method?
(A+B-C)*(E/F)-(G-H/I).
We use Operator stack to convert infix expression to postfix by using following table:
Current Symbol Operator Stack Postfix Expression
3) Let Q be an instance of a Queue ADT. Q.enqueue(x) adds an element x to the queue.
Q.dequeue() performs a dequeue operation on the queue and returns the value that gets
dequeued. Consider the following segment of code:
Q.enqueue(1);
int count=1;
do {
count=count+1;
x = Q.dequeue();
Q.enqueue( 2*x );
Q.enqueue( 4*x );
}
while(x!= 32);
What will be the value of the variable count, when the above segment of code completes its
execution? Display the content of Queue.

4) Determine the value of the following postfix expression when the variables have the
following values: A is 2, B is 3, C is 4, and D is 2, E is 1, F is 5, G is 6, H is 2
(a) A B C D * - E / + F + G H /
(b) A B - C D E F / + G - * - H –

5) Determine the value of the following prefix expression when the variables have the
following values: A is 2, B is 3, C is 4, and D is 2, E is 1, F is 5, G is 6, and H is 2

(a) -+*+ABC/D+E*FGH
(b) - / + * A B C D / E + F G

6) Show heap sort process for the given input 14, 54, 23, 65, 53, 79, 72, 34, 11, 42, 19, 2 by
Minheap() and Maxheap() property.

7) What is the running time complexity of the following program?


(a) for (i = 0; i < n; i++)

if (a[ i ] == x) return 1;
return -1;
(b) for (i = 0; i < n; i++)
for (j = 0; j < m; j++)
if (a[ i ][ j ] == x) return 1 ;
return -1;
8) Perform Merge sort for the following sequence of unsorted array values and find time
complexity of an algorithm in terms of Big O, Big Theta and Big Omega.

9) Given two polynomials in the form of linked list. The task is to find the multiplication of
both polynomials.
INPUT: Poly1: 3x^2 + 5x^1 + 6, Poly2: 6x^1 + 8.
Write C program to perform Polynomial addition by using linked list. Illustrate the input
and output in Linked List.

10) Demonstrate the Application of Linked list and any one of sorting in innovative manner.
(Screen shot of video/photo clips/chart work /flow chart/Algorithm design/Pipeline
Architecture/Diagrammatic representation/Group work/Presentation etc….)

You might also like