DSAmid 2019

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

VEER SURENDRA SAI UNIVERSITY OF TECHNOLOGY (VSSUT), ODISHA

Mid Semester Examination October - 2019

COURSE NAME: B.TECH SEMESTER: 3RD


BRANCH NAME:CSE/IT
SUBJECT NAME:DATA STRUCTURE & ALGORITHM
FULL MARKS: 20 TIME: 2 Hours

Answer All Questions.


The figures in the right hand margin indicate Marks. Symbols carry usual meaning.

Q1. Answer all Questions. [1 × 5]


a) What is data structure? Give an example each of linear and non-linear data structure. - CO1
b) Consider the following functions from positives integers to real numbers 10, √n, n, - CO1
log2n, 100/n. Write the correct arrangement of above functions in increasing order of
asymptotic complexity ?
c) Express in big-O notation: 10n3+6n2. - CO1
d) Which data structure is required to check whether an expression contains balanced - CO5
parenthesis ?
e) Suppose a circular queue is implemented by an array QUEUE[0..11].What is the - CO3
number of elements in the queue, if FRONT=10 and REAR=3 ?

Q2. [5]
a) What are the different asymptotic notations used for algorithm analysis? - CO1

A[R, C] is a 2-D array. The base address is BA, the size of each element is W, the
lower limit of the row subscript is LBR and the lower limit of the column subscript
is LBC. Find the address of the element A[I, J], if the array is stored in i) Row major
form and ii) Column major form.

OR
b) What are the characteristics of an algorithm? - CO1
Represent the amount of time using the Ɵ notation for the following code segment:

(i) for(i=n/2;i<=n;i++) (ii) for(i=1;i<=n;i++)


for(j=1;j<=n;j*=2) { for (j=1;j<=n;j++)
for(k=1;k<=n;k*=2) x=x+1;
x=x+1 for(j=1;j<=n;j=2*j)
x=x+1;
}
Q3. [5]
a) Write an algorithm to evaluate postfix expression - CO2
Assume that the operators +, -, × are left associative and ^ is right associative. The
order of precedence (from highest to lowest) is ^, ×, +, -. What is the postfix
expression corresponding to the following infix expression
a+b×c-d^e^f

OR
b) Write an algorithm to convert an infix expression to postfix expression. - CO2
The following postfix expression with single digit operands is evaluated using a
stack:
823^/23*+51*-
What are the top two elements of the stack after the first * is evaluated?

Q4. [5]
a) Write short notes on i) Array vs Linked List - CO4
ii) Circular Queue vs Linear Queue

OR
b) Write a program to create a single linked list and perform the following operations: - CO3
i) Find out the largest element.
ii) To search an element

You might also like