Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Institute of Southern Punjab

Multan
Department of Computer Science & IT
MID Term Examination
Subject: Design and Analysis of Algorithm
Class: BSCS 6th A, BSCS 6th B, Semester: 1th
BSCS 6th C
Instructor: Waqas Sharif Date: 13-06-2019
Paper Type: Objective Time 10 minutes
Allowed:
Instructions: (Read Carefully)
Read Question Paper carefully. Don’t write anything on the Question Paper except your Registration No and Name.
Question paper is a closed book. Make sure your mobile phone is switched off. Any unauthorized material found
after examination starts will be regarded as possible evidence of cheating or attempting to do so. Avoid cutting /
overwriting.

Choose right answer 1 x 9 Marks

1. The time factor when determining the efficiency of algorithm is measure by counting
a) microseconds b) key operations c) statements d) bytes of algorithm
2. Which case analysis appropriate when the response time of the algorithm is critical?
a) worst b) best c) average d) all are equal
3. The sorting technique based on divide and conquer
a) bubble b) merge c) insertion d) shell
4. Time complexity of merge sort
a) O(1) b) O(n2) c) O(n) d) O(nlogn)
5. The concept of order Big O is important because
a) It can be used to decide the best algorithm that solves a given problem
b) It determines the max size of a problem that can be solved in a given amount of time
c) It is the lower bound of the growth rate of algorithm
d) both a & b
6. On which algorithm is heap sort based on?
a) divide and conquer b) binary search tree c) priority queue d) arrays
7. If several elements are competing for the same bucket in the hash table, what is it called?
a) diffusion b) replication c) chaining d) collision
8. The way a card game player arranges his cards as he picks them one by one can be
compared to
a) insertion sort b) merge sort c) quick sort d) bubble sort
9. In binary tree sort, we first construct the BST and then we perform _ traversal to
get the sorted order.

b) in-order b) pre-order c) post-order d) level-order

1|Page Composed by Mubeena Ali


Institute of Southern Punjab
Multan
Department of Computer Science & IT
MID Term Examination
Subject: Design and Analysis of Algorithm
Class: BSCS 6th A, BSCS 6th B, BSCS 6th Semester: 1th
C
Instructor: Waqas Sharif Date: 13-06-2019
Paper Type: Subjective Time 1 hour 20 minutes
Allowed:

Instructions: (Read Carefully)


Read Question Paper carefully. Don’t write anything on the Question Paper except your Registration No and Name.
Question paper is a closed book. Make sure your mobile phone is switched off. Any unauthorized material found
after examination starts will be regarded as possible evidence of cheating or attempting to do so. Avoid cutting /
overwriting
ATTEMPT Part B. Each question carries equal marks.
Part B 2 x 8 Marks
1. Section A
a) Solve the following the recurrence relation (8)
c n= 0
i. T(n) = { }
T(n − 1)+ 2 n>0
c n= 1
ii. T(n) = { }
T(n/2) + 1 n>1

b) Differentiate between asymptotic notation of big O and big Omega (8)


c) What is mean by optimization problem? Give an example
d) Explain different type of graphs? perform breath first search on a given graph G = (V, E)
e) Explain different type of graphs? perform a depth first search on following given graph
f) Represent a matrix representation of following graph also calculate the space complexity
g) Represent a list represent of following graph
h) Explain dynamic programming
i) Explain greedy algorithm
j) Solve rod cutting problem using dynamic programming
k) Solve following knapsack problem using greedy approach
l) How can we reduce a time of calculating recursive febnocci series using dynamic
programming?
Write a cost comparison of both technique
m) What is shortest path problem? how can we find a shortest path using Dijkstra algorithm
n) What is meant by network flow? Describe frank method to compute max-flow network by given
a graph?
o) What is NP and P class problems?
p) What is meant by disjoin test? How can we find a cyclic graph with union and find
operation?
q) What is mean by string matching?

2|Page Composed by Mubeena Ali


2. Section B

Design an algorithm for insertion sort and calculate the time complexity of algorithm in the form of growth
rate order, also discuss the best and worst case of the algorithm (8)

3|Page Composed by Mubeena Ali

You might also like