Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

BCS 042 2

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

Download More:- https://www.ignouassignmentguru.

com/papers

No. of Printed Pages : 4 BCS-042

DIPLOMA IN CIVIL ENGINEERING


CC
IN- Term-End Examination
vi
\D June, 2013
0
BCS-042 : ANALYSIS AND DESIGN OF
ALGORITHM

Time : 2 hours Maximum Marks : 50

Note : Question number 1 is compulsory. Answer any three


from the rest (Section -B)

SECTION-A
1. (a) Put the following classes of algorithms in 2
increasing order of growth :
(i) 0(n)
(ii) 0(211)
1
log 2 )
(iii) 0 (Oog

(iv) 0(0
(b) Write the names of the following symbols : 3
(i) 0
(ii) n
(iii) v
(c) Write the values of the followings : 3
(i) [4.4]
(ii) [ —4.4]
(iii) log2(4+16)

BCS-042 1 P.T.O.
Download More:- https://www.ignouassignmentguru.com/papers

(d) Write an algorithm for the linear search and 8


analyse its time complexity in best case and
worst case consider the following list :
15, 10, 20, 5, 3, 12, 2
Apply your Algorithm and show the steps
to find an element 12 (i.e key=12) in the list
given
(e) Define 0(Theta) Notation. By using Basic 4
definition of 0, show that 3x + 5 = 0(x)

BCS-042 2
Download More:- https://www.ignouassignmentguru.com/papers

SECTION-B

2. (a) Write a adjacency list and adjacency matrix 5


representation of the following graph :

(b) Find the time complexity of the following : 5

for (i=1; isn; i+ +)


i = i* 2 ;

3. (a) Explain the following terms : 5


(i) Space complexity
(ii) Time complexity
(iii) Recurrence
(iv) Lower bound
(v) Combinational problem
(b) Write a Recurrence Relation for the 5
following Recursive factorial function :
int FACT (int n)

if(n = =1)
return 1
else
return n*FACT(n —1)

BCS-042 3 P.T.O.
Download More:- https://www.ignouassignmentguru.com/papers

4. What is an optimization problem ? What are the 10


data structure and functions required to solve
optimization problem using Greedy techniques.

5. Write a Pseudo code for merge sort algorithm. 10


Apply the merge sort algorithm to sort the
following :
15, 4, 3, 10, 8, 7, 13, 6
Also write the time complexity of merge sort in
worst case.

BCS-042 4
Download More:- https://www.ignouassignmentguru.com/papers

No. of Printed Pages : 3 BCS-042

.1"
BACHELOR OF COMPUTER APPLICATIONS
C) (Revised)
Term-End Examination
December, 2013
BCS-042 : INTRODUCTION TO ALGORITHM
DESIGN
Time : 2 hours Maximum Marks : 50
Note : Question number 1 is compulsory. Answer any three
from the rest.

SECTION - A
1. (a) Put the following classes of algorithms in 2
increasing order of growth.
(i) 0 (n logo)
(ii) 0(logn)
(iii) 0(n2)
(iv) 0 (VT-1)
(b) Define three most common asymptotic 3
notations and its meanings.
(c) Write the values of the followings 3
(i) [3.3]

27
(ii) log 3T
[- 3.3]

BCS-042 1 P.T.O.
Download More:- https://www.ignouassignmentguru.com/papers

(d) Write binary search algorithm and analyze 8


its time complexity is best and worst case.
Apply Binary search algorithm to find the
number of comparisions made by the
algorithm to search a key value
(Say Key = 32), in the following list :
5, 10, 15, 20, 25, 30, 32, 35.
(e) Define 0 (Big-'oh') Notation. By using basic 4
definition show that (3x2 + 4x + 1) = 0(x2)

SECTION - B
2. Write a Pseudo - code for prim's Algorithm to find 10
Minimum cost spanning tree. Apply prim's
Algorithm and find minimum spanning tree for
the following graph (Starting vertex is 1).

Also write its Running time of the algorithm used.

3. Write pseudo - code for DFS. Find DFS for the 10


following graph.

What is the running time of the algorithm.

BCS-042 2
Download More:- https://www.ignouassignmentguru.com/papers

4. (a) Write a Recurrence Relation for the 5


following Recursive function :
Fib (int n)

if(n = = 0) return 0
if(n = =1) return 1
else
return (Fib(n —1) + Fib(n —2))

(b) Find the time complexity of the following


loop :
for (i=1; i<n; i+ +)
i =i * 3

5. (a) What is Greedy technique ? What type of


problems can be solved by using greedy
techniques ?

(b) Apply the Quicksort algorithm to sort the


given elements. 5, 8, 2, 7, 9, 15, 4 units its
time complexity in worst case.

BCS-042 3
Download More:- https://www.ignouassignmentguru.com/papers

No. of Printed Pages : 3 BCS-042


BACHELOR OF COMPUTER APPLICATIONS
(Revised)
Term-End Examination
June, 2014
BCS-042 : INTRODUCTION TO ALGORITHM
DESIGN
Time : 2 hours Maximum Marks : 50
Note : (i) Question number 1 is compulsory.
(ii) Answer any three from the rest.
(iii) Pseudo code should be nearer to
C-Programming language notation

SECTION - A
1. (a) Given the following list of 8 integers, sort 8
them using insertion sort. Determine the
number of comparisons used by the sorting
algorithm as well as the total number of
assignment operations.
25 15 7 10 8 12 6 13
Show the process of sorting.
(b) Define 0 (big theta) notation. By using a 4
basic definition show that
5n2 + 9n — 8 = (n2) .
(c) Draw all the spanning trees of the following 3
weighted connected graph.

BCS-042 1 P.T.O.
Download More:- https://www.ignouassignmentguru.com/papers

(c1) What is recurrence relation ? What is an 5


initial condition ? Define recurrence relation
and initial conditions for the followings :
(i) Fibonacci sequence
(ii) Factorial function

SECTION - B
2. Define a fractional knapsack problem. Find the 10
optimal solution to the following instance of a
knapsack problem. Show step by step running of
the algorithm.
Number of object ; n =5
Capacity of knapsack ; M =10
(P1, P2, P3, P4, P5) (12, 32, 40, 30, 50)
Where Pi is profit
and
(W1, W2, W3, W4, W5) = (4, 8, 2, 6, 1)
Where Wi - is weight
Each object has a profit Pi and weight Wi. The
problem is to fill a knapsack (up to its maximum
capacity M) which maximises the total profit
earned.

3. Write kruskal's algorithm and apply it to find a 10


MST of the following graph also discuss
complexity of the algorithm.

BCS-042 2
Download More:- https://www.ignouassignmentguru.com/papers

4. (a) Define the following terms : 8


(i) Mathematical Induction
(ii) Dynamic programming technique
(iii) Optimization problem
(iv) Single source shortest path problem
(b) What is a complete graph. Draw a complete 2
graph with four vertics.

5. (a) For the given graph, write DFS and BFS 8


travel sequence from the node A.

(b) Arrange the following growth rates in 2


increasing order :
0(3n), 0(n2), 0(1), 0(nlog n)

BCS-042 3
Download More:- https://www.ignouassignmentguru.com/papers

No. of Printed Pages : 4 BC S-042

BACHELOR OF COMPUTER APPLICATIONS


(Revised)
Term-End Examination
December, 2014
01144

BCS-042 : INTRODUCTION TO ALGORITHM DESIGN

Time : 2 hours Maximum Marks : 50

Note : Question number 1 is compulsory. Answer any


three from the rest. Pseudo code should be nearer
to C-programming language notation.

SECTION A

1. (i) Given a list of integers (shown below),


determine the number of comparisons and
assignment operation used by bubble sort
to sort the list. Show the process of sorting.

35 8 7 15 25 30 10 12
Perform worst case analysis. 10
(ii) Prove or disprove the following using the
basic definition of 0 (big Oh) : 2
5n2 + 8n + 15 = 0(n2)
BCS-042 1 P.T.O.
Download More:- https://www.ignouassignmentguru.com/papers

(iii) Group the following function by complexity


category : 2
2n, n, n!, , 4n + 12

(iv) Apply DFS and BFS to the complete graph


on four vertices. List the vertices in the
order they would be visited.

BCS-042 2
Download More:- https://www.ignouassignmentguru.com/papers

SECTION B

2. Write Prim's algorithm and apply to find


minimum cost spanning tree for the following
graph : 10

3. Illustrate the working of binary search tree while


searching for the element 14 in the following
sorted array :

8 14 20 25 35 45 50 85 95 100

Also analyze the algorithm for best and worst


cases. 10

4. (i) What is recurrence relation ? Write a


recurrence equation for any algorithm
which follows Divide and Conquer strategy
and explain it. 5

BCS-042 3 P.T.O.
Download More:- https://www.ignouassignmentguru.com/papers

(ii) Define the following terms : 5


• Backtracking
• Dynamic Programing
• Time Complexity
• Asymptotic Analysis
• Upper Bound

5. (i) Suppose you are given currency notes of all


denominations, e.g. (2, 5, 10, 15, 20, 100,
500). Further it is assumed that currency
notes of each denomination are available in
sufficient numbers for the purpose of using
the minimum number of notes. The
problem is to find the minimum number of
currency notes to make the amount of 437
using the Greedy approach. Show the
sequence of steps for selection and rejection
of notes. 6

(ii) Define the following terms : 4


• Connected Graphs
• Path
• Cycle
• Tree

BCS-042 4 6,000
Download More:- https://www.ignouassignmentguru.com/papers

No. of Printed Pages : 3 BCS 042 I


-

BACHELOR OF COMPUTER APPLICATIONS


(Revised)
0 2 0 6 3 Term-End Examination
June, 2015

BCS-042 : INTRODUCTION TO ALGORITHM DESIGN

Time : 2 hours Maximum Marks : 50

Note : Question number 1 is compulsory. Answer any


three questions from the rest.

1. (a) Write an algorithm to compute an by left


to right binary exponentiation method and
illustrate through an example. 6

(b) Do the complexity analysis of the above


algorithm.

(c) Put the following classes of algorithm in


the increasing order of growth :
o(e), 0(n log2 n), O(log2 n), 0(n).
(d) Using the definition of Big Oh, show that 4
6n2+ 20 n = 0(n3).

BCS-042 . P.T.O.
Download More:- https://www.ignouassignmentguru.com/papers

(e) What is the difference between a graph


and a tree ? Draw four spanning trees of
the following graph : 4

2. Apply Kruskal's algorithm to find a minimum


cost spanning tree of the following graph : 10
C

3. (a) Apply the Merge Sort algorithm to sort the


following list :

15 5 8 7 4 20 25

(b) Describe any two methods of solving the


recurrence relation. 4

BCS-042 2
Download More:- https://www.ignouassignmentguru.com/papers

4. Explain the following terms with examples : 10


(a) Complete graph
(b) Combinatorial problems
(c) Branch and bound technique
(d) Loose bound
(e) Average case

5. (a) Find the optimal solution to the knapsack


instance (fractional) :
n = 5, M = 10
(Pi, P2, 133, P4, P5) = (14, 24, 32, 18, 20)
(W1, W2, W3, W4 , W5) = (7, 8, 4, 3, 5)

(b) What is a single source shortest path


problem ? What are the proposed solutions ?
4

BCS-042 3 6,000
Download More:- https://www.ignouassignmentguru.com/papers

0 40
No. of Printed Pages : 3 BCS-042

BACHELOR OF COMPUTER APPLICATIONS


(BCA) (Revised)
Term-End Examination
December, 2015

BCS 042 : INTRODUCTION TO ALGORITHM DESIGN


-

Time : 2 hours Maximum Marks : 50

Note : Question no. 1 is compulsory, carrying 20 marks.


Answer any three questions from the rest.

1. (a) Using the definition of SZ , show that


6n2 + 20n # SI (n3). 4

(b) Given a list of n distinct integers. Write an


algorithm to determine the position of an
integer in the list using a linear search and
count the number of comparison operations
required. 6

(c) By applying induction method, show that


for all positive integers n
12 ± 22 + + n2 = n(n + 1) (2n + 1)
6
6

BCS-042 1 P.T.O.
Download More:- https://www.ignouassignmentguru.com/papers

(d) Illustrate the representation of the


following graph through adjacency list and
adjacency matrix : 4
A

2. (a) Find the optimal solution to the knapsack


(fractional) problem n = 5 and m = 10,
where n is the number of objects and
m is the capacity of knapsack. 6
Profit and weight of each object are given
below :
(Pi, P2, P3, P4, P5) = (10, 30, 35, 20, 40)

(W1, W2, W3, W4, W5) = (3, 5, 2, 6, 1).

(b) Write Prim's algorithm to find the


minimum cost spanning tree. 4

. (a) Apply QuickSort to sort the following


array. Show all the steps. 6

15 5 10 8 7 2 20 30

(b) What are the worst case and best case in


QuickSort algorithm ? 4

BCS-042 2
Download More:- https://www.ignouassignmentguru.com/papers

4. Define the following terms : 10


(a) Optimization
(b) Dynamic programming
(c) Recurrence relation
(d) Asymptotic bounds
(e) Unconnected graph

5. For the given graph, apply DFS traversal scheme


and write DFS sequence. Also write the time
complexity of DFS and BFS algorithms. 10

BCS-042 3 7,000
Download More:- https://www.ignouassignmentguru.com/papers

No. of Printed Pages : 3 I BCS-0421


BACHELOR OF COMPUTER APPLICATIONS
(BCA) (Revised)
Term-End Examination
June, 2016
00006
BCS-042 : INTRODUCTION TO ALGORITHM DESIGN
Time : 2 hours Maximum Marks : 50

Note : Question no. 1 is compulsory, carrying 20 marks.


Answer any three questions from the rest.

1. (a) What is an algorithm ? Briefly explain


time complexity and space complexity of
an algorithm. 5
(b) Define notation Si (Big Omega). If
f(n) = 2n3 + 3n2 + 1 and g(n) = 2n2 + 3, then
show f(n) = 52 (g(n)). 4
(c) Arrange the following growth rates in
increasing order : 2

0(n2), 0(311), 0(n), 0(log


(d) Draw all minimum spanning trees of the
following weighted connected graph : 4
5

10

BCS-042 1 P.T.O.
Download More:- https://www.ignouassignmentguru.com/papers

(e) Write linear search algorithm and explain


its best case, worst case and average case
time complexity. 5

2. (a) Given the following list of 8 integers, sort


them using insertion sort. Determine the
number of comparisons required by the
algorithm. Also find the total number of
assignment operations in this process. 8

10 7 12 6 8 15 25 11

(b) Write any four characteristics of greedy


algorithm. 2

3. (a) What is recurrence relation ? Draw a


recursion tree for recurrence
T(n) = 2T (n - 1) + 1. 4

(b) Write adjacency list and adjacency matrix


representation of the following graph : 6

BCS-042 2
Download More:- https://www.ignouassignmentguru.com/papers

4. (a) Write binary search algorithm and search


the value 28 in the following list, using
binary search algorithm and show the
steps :
1, 7, 18, 27, 28, 30, 39

(b) Write Prim's algorithm for finding


minimum spanning tree. Find the
complexity of this algorithm. 5

5. (a) Define the following terms : 4


(i) Connected graph
(ii) Cycle in an undirected graph

(b) Consider the following fractional knapsack


problem :
M = 20;
Profits
(131, 132, P3) = (25, 24, 15)
(w1, w2, w3) = (18, 15, 10)
Show the running of the greedy algorithm
for fractional knapsack.

BCS-042 3 6,000
Download More:- https://www.ignouassignmentguru.com/papers

No. of Printed Pages : 3 I BCS-0421


BACHELOR OF COMPUTER APPLICATIONS
(BCA) (Revised)
Term-End Examination
December, 2016
D0906
BCS-042 : INTRODUCTION TO ALGORITHM DESIGN
Time : 2 hours Maximum Marks 50

Note : Question no. 1 is compulsory and carries 20


marks. Answer any three questions from the rest.

1. (a) Define 0 (big oh) notation and prove or


disprove the following using the basic
definition of 0 (big oh) 4
2n3 + n2 + 10 = 0(n 3)
(b) Order the following functions in increasing
order of O( ) notation : 3
3n, n, n!, n2 + 5, 2n2 + 3, 5n + 2
(c) Traverse the following graph using
Depth First Search (DFS), the starting
node is A.

BCS-042 1 P.T.O.
Download More:- https://www.ignouassignmentguru.com/papers

(d) Write Prim's algorithm and apply it to find


the minimum cost spanning tree for the
following graph : 8

2. (a) What is a recurrence relation ? Define


Fibonacci sequence using a recurrence
relation. 4

(b) Write bubble sort algorithm and find its


time complexity. 6

3. (a) Suppose you are given scoring shots


(0, 1, 2, 3, 4, 5, 6); a cricketing batsman can
score on one shot. Further it is assumed
that there is no limit to a batsman to score
on any shot. The problem is to find the
minimum number of shots to score
100 runs, using Greedy approach. Show the
sequence of steps for selection and rejection
of shots. 8

(b) Explain best case and worst case in linear


search algorithm. 2

BCS-042 2
Download More:- https://www.ignouassignmentguru.com/papers

4. (a) Define the following terms in an undirected


graph, where V is the set of vertices and E
is the set of edges :
(i) Path
(ii) Cycle
(iii) Tree
(iv) Spanning Tree
(b) Sort the following list using Quick-Sort
algorithm. Show the intermediate steps in
the, process :

2 8 7 3 5 6 4

5. (a) Define the following terms :


(i) Asymptotic lower bound of a function
(ii) Space complexity
(iii) Asymptotic upper bound of a function
(b) Write the general form of a recurrence
relation for a divide-and-conquer algorithm
and explain the different parts of this
recurrence relation.

BCS-042 3 6,500
Download More:- https://www.ignouassignmentguru.com/papers

No. of Printed Pages : 3 I-BCS-042

BACHELOR OF COMPUTER APPLICATIONS


(BCA) (Revised)
Term-End Examination
i•-• June, 2017 •

BCS-042 : INTRODUCTION TO ALGORITHM DESIGN

Time : 2 hours Maximum Marks : 50

Note : Question no. 1 is compulsory. Answer any three


questions from the rest.

1. (a) Write the linear search algorithm and


analyse its time complexity in worst case. 4

(b) Arrange the following functions in


increasing growth order

(i) 0(n3)

(ii) 0(2n)

(iii) 0(log n)

(iv) 0( )

(c) Write the recursive algorithm to calculate


xn using Divide and Conquer.

BCS-042 1 P.T.O.
Download More:- https://www.ignouassignmentguru.com/papers

(d) What is Minimum Cost Spanning Tree


(MCST) ? Apply Prim's algorithm to find
MCST for the following graph : 4
1 8 2

4 12 3

(e) Show that the worst case time complexity


of Quick sort is 0(n2 ), where n is the size of
array elements. 3
(0 Create adjacency list for the following graph : 3
A

2. (a) Apply Dijkstra's algorithm to find the single


source shortest path for the following graph : 5
1
10

BCS-042 2
Download More:- https://www.ignouassignmentguru.com/papers

(b) Apply the Merge sort algorithm to sort the


following list :
15, 8, 6, 12, 20, 7, 18, 5

3. (a) What is recurrence relation ? Draw a


recurrence tree for recurrence

T(n) = 3T (—
n ) + n. 5
2
(b) Write the Breadth First search algorithm
and calculate its time complexity. 5

4. (a) Find the time complexity of the following


code : 5
for (i = 1; i < = n; i ++)
{

if (A[i] > BUD


print A[i];
1
(b) Find the optimal solution to the fractional
knapsack problem for n = 5,
M(capacity of knapsack) = 10 and
(Pi , P2, P3, P4, P5) = (12, 32, 40, 30, 50)

(w1 , w2, w3, w4, w5) = 4, 8, 2, 6, 1) 5

5. Explain the following terms with examples : 10


(a) Space Complexity
(b) Asymptotic Notation
(c) Binary Search
(d) Master Method for Solving Recurrence

BCS-042 3 6,000
Download More:- https://www.ignouassignmentguru.com/papers

No. of Printed Pages : 4 I BCS-0421


BACHELOR OF COMPUTER APPLICATIONS
(BCA) (Revised)
Term-End Examination
036E30
December, 2017

BCS-042 : INTRODUCTION TO ALGORITHM DESIGN

Time : 2 hours Maximum Marks : 50

Note : Question no. 1 is compulsory. Answer any three


questions from the rest.

1. (a) Arrange the following functions in


increasing order of growth rates :

(i) 0(log n)

0(n3)

(iii) 0(5n)

(iv) 0(n log n)

(b) What is an Algorithm ? Briefly explain the


meaning of complexity of an algorithm. 5

(c) Define 0 (big oh) notation. Prove or


disprove the following : 5
2n2 + 3n + 1= 0(n2)
BCS-042 1 P.T.O.
Download More:- https://www.ignouassignmentguru.com/papers

(d) Write a binary search algorithm and


analyse its time complexity in best case
and in worst case.
(e) Create an adjacency matrix for the
following graph :
A

Figure 1

2. (a) Write an algorithm for Depth-First Search


(DFS) and traverse the following graph
using DFS : (Starting vertex is A) 7
A

Figure 2

(b) Explain the difference between directed


and undirected graphs. 3

BCS-042 2
Download More:- https://www.ignouassignmentguru.com/papers

3. (a) Apply the Quick-sort algorithm to sort the


following list : 5
5, 9, 8, 4, 2, 15, 6

(b) Find the minimum cost spanning tree from


the following graph using Kruskal's
algorithm 5
A 5 B 1 E

2 4 3 9

C 6 D 2 F

Figure 3

4. (a) By using mathematical induction, prove that


p(n) = 12 + 22 + 32 + + n2 = n(n + 1) (2n + 1)
6

(b) Consider the following fractional Knapsack


problem :
M = 15 and
(P1, P2, P3) = (25, 24, 15) and

(W1, W2, W3) = (18, 15, 10)

Show the running of the greedy algorithm


for the fractional Knapsack problem.

BCS-042 3 P.T.O.
Download More:- https://www.ignouassignmentguru.com/papers

5. Explain the following terms with examples : 10

(a) Combinatorial Problem

(b) Complete Graph

(c) Backtracking

(d) Asymptotic Notations

BCS-042 4 5,500
Download More:- https://www.ignouassignmentguru.com/papers

No. of Printed Pages : 3 I BCS-042 I

BACHELOR OF COMPUTER APPLICATIONS


(BCA) (Revised)

Term-End Examination

June, 2018
CI 6 .7 ._"_1*

BCS-042 : INTRODUCTION TO ALGORITHM DESIGN

Time : 2 hours Maximum Marks : 50


Note : Question no. 1 is compulsory and carries
20 marks. Answer any three questions from the
rest.

1. (a) Define 0 (Big-"Oh") notation. By using


basic definition of 0, show that
(3x2 + 4x + 1) = 0(x2). 4

(b) The recurrence relation for Fibonacci


sequence is given by to = tn_i + tn_2, such
that to = 0 and ti = 1. Find the solution of
this recurrence.

(c) Find the optimal solution to the fractional


knapsack instance n = 5, capacity(M) = 10;
(Pi, 132, •••, P5) = (12, 32, 40, 30, 50)
(wi, w2, w5) = (4, 8, 2, 6, 1) 5
BCS-042 1 P.T.O.
Download More:- https://www.ignouassignmentguru.com/papers

(d) Write Adjacency list and Adjacency matrix


representation for the following graph :

(e) Find time complexity of the following code :


for (i = 1; i <= n; i ++)
for (j = 1; j <= n; = j * 2)
Sum[i] = Sum[i] + i x j.

2. (a) Differentiate between Depth-First Search


(DFS) and Breadth-First Search (BFS) in
terms of time and space complexity.
Traverse the following graph using
(i) DFS, (ii) BFS, the starting node is A.

(b) List all the steps to be used to search 30 in


the following list using binary search :
6 8 10 12 30 32 35
BCS-042 2
Download More:- https://www.ignouassignmentguru.com/papers

(a) Write Quick-sort algorithm and find its


time complexity in worst case. 5
(b) Multiply 10265 x 2573 using Divide and
Conquer technique. Apply Karatsuba
method. 5

4. Write any two applications of spanning tree.


Write Prim's algorithm and apply it to find the
minimum cost spanning tree for the following
graph 10

5. (a) Write all the 0 cases of Master method for


solving Recurrence. Apply Master method
to solve the following recurrence :

T(n) = 3T( —
n ) + n log n
4
(b) Write algorithm of bubble sort.

BCS-042 7,000
Download More:- https://www.ignouassignmentguru.com/papers

No. of Printed Pages : 4 I BCS-042


BACHELOR OF COMPUTER APPLICATIONS
(BCA) (Revised)

Term-End Examination
ODD ex.
December, 2018

BCS-042 : INTRODUCTION TO ALGORITHM DESIGN

Time : 2 hours Maximum Marks : 50

Note : Question no. 1 is compulsory and carries


20 marks. Answer any three questions from the
rest.

1. (a) Define a (Big 'Omega') notation. By using


basic definition of a show that
f(n) = a(g(n)),

where f(n) = 2n3 3n2 + 1, and

g(n) = 2n2 + 3.

(b) What is an algorithm ? Explain the


meaning of time complexity and space
complexity of an algorithm. 6

BCS-042 P.T.O.
Download More:- https://www.ignouassignmentguru.com/papers

(c) Arrange the following functions in


increasing order of growth
n3, 2n2 + 3, 5n + 2, 5n, 2n. 3
(d) Define the following terms : 4
(i) Spanning tree
(ii) Adjacency matrix
(e) Find the time complexity of the following
loop : 3
for (i = 1; i <= n; i ++)
{

i = i * 2;

2. (a) Write algorithm to multiply two square


matrices of order n x n and find its time
complexity.
(b) Using Insertion sort, sort the following list
and show all the intermediate steps :
8 6 4 15 9 25 2

3. (a) Find the optimal solution to the knapsack


instance n = 5, capacity M = 15,
(pi, P2, P5) = (15, 35, 48, 30, 40)

(w1 , w2, w5) = (4, 8, 5, 6, 2).

(b) Prove that


+ 22 4. n2= n(n + 1) (2n + 1) , by
P(n) : 12
6
using mathematical induction. 3
BCS-042 2
Download More:- https://www.ignouassignmentguru.com/papers

4. (a) Write pseudo code for Breadth-First Search


(BFS). Traverse the following graph using
BFS, the starting node is A.

(b) Solve the following recurrence relation


using recursion tree method : 3

T(n) = 4T(1-1- ) + n
2

5. (a) Write Kruskal's Algorithm to find


Minimum Cost Spanning Tree (MCST) of
the following graph : 6

BCS-042 3 P.T.O.
Download More:- https://www.ignouassignmentguru.com/papers

(b) Write an algorithm to search an element


(say x) using Binary Search. Analyze its
time complexity in worst case. 4

BCS-042 4 4,500
Download More:- https://www.ignouassignmentguru.com/papers

04292
No. of Printed Pages : 4 BCS-042

BACHELOR OF COMPUTER APPLICATIONS


(BCA) (Revised)

Term-End Examination, 2019


BCS-042 : INTRODUCTION TO ALGORITHM DESIGN

Time : 2 Hours] [Maximum Marks : 50

Note : Question no.1 is compulsory. Attempt any three


questions from the rest.

1. (a) Arrange the following functions in increasing


growth order : [2]

(i) 0 (n 2)

(ii) 0 (log n)

(iii) 0 (2")

(iv) 0 (n log n)

(b) Define 0 (Theta) Notation. Let f (n) and


g(n) are two Positive Functions. Prove or
Disprove the following : [51

(i) f (n) + g(n) = 0(min{ f (n), g(n)))


BCS 042
-
(I ) [P.T.O.]
Download More:- https://www.ignouassignmentguru.com/papers

(ii) 3n 2 + 5 = 19(n 2 )

(c) Write Prim's Algorithm to solve the Minimum cost


spanning tree (MCST) problem. Analyze the time
complexity of the algorithm also. Apply Prim's
Algorithm for the following graph and find the
Minimum Cost of the Spanning tree. [ 7]

(Starting Vertex 'A')


5

(d) Apply Recursion Tree Method to find the


asymptotic upper bound for the following

(n '"

Recurrence : T(n) = 2T — + n [4]


2

(e) Create Adjecency list for following graph : [2]

BCS-042 (2)
Download More:- https://www.ignouassignmentguru.com/papers

2. (a) Find the optimal solution to Knapsack (fractional)


problem x = 5 and M = 10, where x is the number
of objects and M is the capacity of Kanpsack.
Profit and weight of each object are given below :
[6]

(P 1 , P2 , P3 , P4 , P5 ) = (10, 30, 35, 20, 40)

(W,, W 2 , W3 , W4 , W5) = (3, 5, 2, 6, 1)

(b) Multiply 2432 X 5219 using Divide and Conquer


Method (use Karatsaba Method). [4]

3. (a) Apply PARTITION procedure of QUICKSORT for


the following array to find the final position of the
last element 9 (Pivat element). Show all the
intermediate steps. [5]

10 15 7 6 20 9

(b) Write DFS algorithm and find its time complexity.

[5]

4. (a) Find the complexity of the following code : [3]

for (i = 1; i < = nj i++)

{ for (j = 1; j < = n jj++)

BCS-042 (3) LP.T.0.j


Download More:- https://www.ignouassignmentguru.com/papers

ifA[j]>B[i]

Print A [ j ];

(b) Explain the concept of RELAXING an edge in


Dijkstra's Algorithm. Apply Dijkstra's Algorithm to
find the shortest path for the following graph.
(Starting Vertex is 'A') [7]

5. (a) Write an algorithm to search an element (Say x)


Using Binary Search. Analyze the time complexity
of the algorithm in Worst Case. [5]

(b) Discuss all the three cases of Master Method to


(
solve the Recurrence T (n) = aT + f( n )
o bi
Where a > 1, b > 1. [5]

BCS-042 (4) 6000


Download More:- https://www.ignouassignmentguru.com/papers

5344
No. of Printed Pages : 4 BCS-042

BACHELOR OF COMPUTER APPLICATIONS


(BCA) (Revised)

Term-End Examination, 2019

BCS-042 : INTRODUCTION TO ALGORITHM DESIGN

Time : 2 Hours Maximum Marks : 50

Note : Question no. 1 is compulsory. Answer any three


questions from the rest.

1. (a) Let f(n) and g(n) are two positive functions, using
basic definition of Big Oh ("0") and Theta (0),
prove/disprove the following : [5]

(i) max{f(n), g(n)} = 0(f(n) + g(n))

(ii) 2" = 0(2 11+1 )

(b) Solve the following Recurrence using Recursion


tree method : [5]

T(n) = 2T (n-1) + 1

Find tight solution of the Recurrence.

BCS-042/6500
( 1 ) 1111111111111111111111111111
Download More:- https://www.ignouassignmentguru.com/papers

(c) Explain general algorithm to solve any problem


,using Greedy techniques. Write any two
characteristics of Greedy Algorithm. [5]

(d) Write Algorithm to solve Knapsack (fractional)

problem using Greedy Method. Find the running


time of the algorithm also. [5]

(a) Define minimum spanning tree. Apply Kruskal's

Algorithm to find minimum cost spanning tree for


the following graph : [6]

(b) Write bubble sort algorithm and find its time


complexity in worst case. [4]

BCS-042/6500 (2)
Download More:- https://www.ignouassignmentguru.com/papers

3. (a) For the following graph write DFS (sequence of


traversal) from the node A : [4]

(b) Apply master method to solve the following


recurrence relation : [6]

n
(i) T (n) = 2T ( \ +n

(n
(ii) T (n) = 3T — + n log n
\4)

4. Explain Dijkstra's Algorithm to find a single source


shortest path in a given graph. Apply Dijkstra's Algorithm
and find the shortest path from source vertex 'A' to rest
of the vertices : [10]

BCS-042/6500 ( 3 ) [P.T.O.]
Download More:- https://www.ignouassignmentguru.com/papers

10

5. Differentiate between the following with respect to method •


of solving a problem and time complexity : [10]

(a) Depth-First-Search (DFS) Vs. Breath-First-


Search (BFS)

(b) Bellman-Ford Algorithm Vs Dijkstra's Algorithm


for single source shortest path.

BCS-042/6500 (4)
Download More:- https://www.ignouassignmentguru.com/papers

No. of Printed Pages : 4 ?KS-042

BACHELOR OF COMPUTER APPLICATIONS


(BCA) (Revised)

Term-End Examination

BCS-042 : INTRODUCTION TO ALGORITHM


DESIGN

Time : 2 Hours] [Maximum Marks : 50


Note: Question number 1 is compulsory.Answer any three
auestions from the rest.

1. (a) For funtction defined by: 4

(n)= 5n3 + 6n2 + 7n + 8 ; show that:

(i) (n) = 0 (n3 )

(ii) 1(7) # 0(n)


(b) Write an algorithm to search the smallest
number in a given array. Also calculate its time
complexity. 6
(c) Draw all the spanning trees for the following
weighted graph: 5
Download More:- https://www.ignouassignmentguru.com/papers

(d) For the given graph, write DFS traversal


sequence from the node A: 5

(a) Sort the following list of elements using Quick


sort. Also show intermediate steps of the
operation. 6

29, 6, 27, 8, 6, 2, 45, 90

(b) Define optimization problem. Give any two


examples of optimization problem with
explanation. 4
3. (a) Find the optimal solution to the following
fractional Knapsack problem using Greedy
Technique: 7

(i) No. of object 11 = 6

(ii) Max. weight = 25

(iii) Value of each item =

(P 1 , P2 , P 3 , P4 , P5 , P6 ) = (10, 20, 30, 35, 45, 55)


Download More:- https://www.ignouassignmentguru.com/papers

(iv) Weight of each item =

(W1, W2, W3, W4, W5, W6) = (5, 10, 12, 13, 15, 20)
(b) Write recurrence relation for binary search
algorithm. 3
4. (a) Solve the following recurrence relation: 3

T (n) = 3T (n 12) + n
(b) Find minimum cost spanning tree for the
following graph using Kruskal's algorithm: 7

5. (a) Find Adjacency Matrix for the following


graph: 3

(b) Find the complexity of following code:


int P = 100;
while (P)
Download More:- https://www.ignouassignmentguru.com/papers

C{ For (i = 1; i < 11 ; i++)


SUM [i]= P- 1;
3_ P = P - 1;

Make necessary assumptions required. 4


(c) Describe any two methods to solve recurrence
relations.

-x -
Download More:- https://www.ignouassignmentguru.com/papers

No. of Printed Pages : 4 BCS-042

BACHELOR OF COMPUTER
APPLICATIONS (BCA)
Term-End Examination
December, 2020
BCS-042 : INTRODUCTION TO ALGORITHM
DESIGN

Time : 2 Hours Maximum Marks : 50

Note : (i) Question No. 1 is compulsory which


carries 20 marks.
(ii) Answer any three questions from the
rest.

1. (a) Arrange the following growth rates in the


increasing order of running time : 2

O (3n ), O (n3 ), O (n), n !, log n

(b) Define recurrence relation and initial


condition for the merge sort algorithm and
explain. 4
(c) Where is Ω (omega) notation used ? For the
function defined by : 4

f (n) = 5n3 + 5n2 + 1

Lot-I P. T. O.
Download More:- https://www.ignouassignmentguru.com/papers

[2] BCS-042

and (n) 5n2 + 5


g=
show that :
f (n) = Ω g (n)
(d) Traverse the following graph using DFS
taking A as a starting vertex and write the
sequence of vertices in the order of their
discovery. 3

(e) (i) Apply the linear search algorithm to


search for the number (4) in the
following list of integer numbers.
Show the starting three steps : 3
5 15 8 4 25 30 17 20
(ii) Analyze the worst case complexity of
the above algorithm. 4
2. (a) Find node degree of all nodes of a graph in
Q. 1 (d). 3
Download More:- https://www.ignouassignmentguru.com/papers

[3] BCS-042

(b) Write the Bellman Ford algorithm and


apply the same to find the shortest path
from a source vertex A to all the remaining
vertices of the following directed graph.
Show all the intermediate steps. 7

3. (a) For the two values of n = 1, 4, calculate the


corresponding values of n log 2 n . 2

(b) Define a fractional knapsack problem. Find


the optimal solution to the following
instance of a knapsack problem. Show the
stepwise running of the algorithm for the
following example : 8
No. of objects n = 5, M = 13
Capacity of a knapsack :
(P1 , P2 , P3 , P4 , P5 ) = (12, 32, 40, 30, 50)

P. T. O.
Download More:- https://www.ignouassignmentguru.com/papers

[4] BCS-042

where Pi is a profit and :


(W1 , W2 , W3 , W4 , W5 ) = (4, 8, 2, 6,1)

where Wi is a weight.

Each object has a profit Pi and weight Wi .

4. (a) Apply binary search algorithm to search


for a key value = 23 in the following list : 5
6 9 13 15 23 27 35 45
(b) Perform the worst case analysis of the
above algorithm and also specify an
example in which worst case will occur. 5

5. (a) Apply Karatsuba’s method in multiplying


2376201 and 219237 using divide and
conquer technique. 5
(b) Define mathematical induction. Prove the
following preposition using induction : 5
12 + 22 + 33 + ..... + n2
n (n + 1) (2n + 1)
=
6

BCS–042
No. of Printed Pages : 3 BCS-042

BACHELOR OF COMPUTER APPLICATIONS


(BCA) (Revised)
Term-End Examination
June, 2021

BCS-042 : INTRODUCTION TO ALGORITHM DESIGN

Time : 2 hours Maximum Marks : 50


Note : Question no. 1 is compulsory and carries
20 marks. Answer any three questions from the
rest.

1. (a) Arrange the following classes of algorithms


in increasing order of growth : 3
(i) O (n3)
(ii) O (n log n)
(iii) O (n2)
(iv) O ( n )

(b) Write the recurrence relation for the


following recursive function : 5
Fib (int n)
{
if (n == 0) return 0;
if (n == 1) return 1;
else
return (Fib (n – 1) + Fib (n – 2));
}

BCS-042 1 P.T.O.
(c) Sort the following list of elements using
‘Insertion Sort’. Also, show intermediate
steps.
28, 6, 29, 90, 5, 42, 80 6
(d) Write the recurrence relation for the best
case of Quicksort algorithm and solve it
using Master method. 6

2. (a) Write the pseudocode for computing


GCD (m, n) and find its time complexity. 4
(b) Write the pseudocode for Breadth First
Search (BFS) and traverse the following
graph using BFS from starting node A. 6

3. (a) What is Greedy Technique ? Explain the


types of problems solved by using this
technique. 4
(b) Find the adjacency list for the following
graph : 3

(c) With the help of an example, explain the


‘Merge-Sort’ technique. 3
BCS-042 2
4. (a) What is a single source shortest path
problem ? Briefly explain the generic
algorithm for solving it. 5

(b) Explain the following terms with an


example for each : 5
(i) Complete Graph
(ii) Dynamic Programming Technique

5. (a) Find the minimum cost spanning tree for


the following graph using Kruskal’s
algorithm : 7

(b) Define Recurrence Relation and Initial


Condition for Factorial Function. 3

BCS-042 3 P.T.O.
[2] BCS-042

(c) Define O (big Oh) notation. By using the


No. of Printed Pages : 4 BCS-042
basic definition O (big Oh), show that : 4

BACHELOR OF COMPUTER 6x 2  6x  1  O ( x 2 )

APPLICATIONS (BCA) (d) Create an adjacency matrix for the


(Revised) following graph : 3

Term-End Examination
December, 2021
BCS-042 : INTRODUCTION TO ALGORITHM
DESIGN

Time : 2 Hours Maximum Marks : 50

Note : (i) Question No. 1 is compulsory which


carries 20 marks. (e) Multiply 10056 × 2037 using divide and
conquer technique. Apply Karatsuba’s
(ii) Answer any three questions from the
method. 4
rest.
(f) Briefly explain any two different
1. (a) State True or False :
approaches to solve the recurrence
O (n log 2 n ) is better than O (n2 ) but not relation. 5

as food as O (n). 2 2. (a) Arrange the following growth rate in

(b) Write the names of the following symbols : 2 increasing order : 2

, ,  O (2n ), O ( n3 ), n!, n

P. T. O.
[3] BCS-042 [4] BCS-042

(b) (i) Traverse the following graph using 4. (a) Write a recurrence relation for the
BFS. The starting node is A : 4 following recursive factorial function : 3

int fact (int n)


{
if (n = = 1)
return 1
else
return n * fact (n – 1)
}
(ii) Perform the complexity analysis of the
(b) State Horner’s rule for polynomial
above algorithm. 4
evaluation and apply the rule for
evaluating the following polynomial
3. (a) Explain the basic concept of quick sort
expression : 7
algorithm and apply it to sort the following
p ( x )  6 x 7  7 x 6  5x 5  3x 3  6 x 2
list of numbers : 7 + 8x + 7

15 10 5 4 25 35 7 8 Show stepwise iteration.

5. (a) How many comparisons are needed for


Show all the intermediate steps.
binary search algorithm in a set of 64
(b) Define the term backtracking and enlist elements ? 3
(b) Write Prim’s algorithm to solve minimum
any two problems that can be solved by
cost spanning tree problem and explain. 7
backtracking. 3
BCS–042

P. T. O.

You might also like