You are on page 1of 5

Reg. No.

I SEMESTER M.C.A. INTERNAL EXAMINATIONS OCTOBER 2017


TEST - 2
SUBJECT: ADVANCED DATA STRUCTURES AND ALGORITHMS [MCA 4102]
Date of Exam: 16-10-2017 Time of Exam: 9.15 AM - 10.15 AM Max. Marks: 15

Instructions to Candidates:
 Answer ALL the questions.
 Missing data may be suitably assumed.

1 Write the bit vector representation of the set { 0, 1, 9, 5, 13, 15, 12 }. 1


2 What do you mean by a bridge in a graph? 1
3 Define the term strongly connected graph. 1
4 Write the expressions for the time and space complexity of BFS. 1
5 What is topological sort of a directed acyclic graph? 1
6 What is an AVL tree? Draw an AVL containing 10 nodes (of integers). Show the 2
balance factor of each node.
7 What do you mean by adjacency matrix of an unweighted graph G = (V, E)? 2
Write the adjacency matrix for the following graph.

Page 1
8 What is a max tree and a max heap? Draw a max heap for the following set of 3
integers: 5, 4, 9, 2, 1, 7.
9 Define the terms spanning tree and minimum spanning tree? Draw the minimum 3
spanning tree for the following graph.

Page 2
MANIPAL INSTITUTE OF TECHNOLOGY
(A constituent Institute of Manipal University, Manipal)

DEPARTMENT OF COMPUTER APPLICATIONS

I SEMESTER M.C.A.
ADVANCED DATA STRUCTURES AND ALGORITHMS (MCA 4102)
Sessional: II Date: 16-10-2017 Duration: 1 hour Max. Marks: 15

SCHEME OF EVALUATION

1 Write the bit vector representation of the set { 0, 1, 9, 5, 13, 15, 12 }.


The bit vector representation of the set { 0, 1, 9, 5, 13, 15, 12 } is
1 0 1 1 0 0 1 0 0 0 1 0 0 0 1 1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

2 What do you mean by a bridge in a graph?


A bridge in the graph is an edge whose removal would break the graph into two connected
components.
3 Define the term strongly connected graph.
A directed graph is strongly connected if, for every pair of vertices vi and vj, there is a
directed path from vi to vj and from vj to vi.
4 Write the expressions for the time and space complexity of BFS.
The time complexity of BFS is O (|V| + |E|) and the space complexity is O (|V|).
5 What is topological sort of a directed acyclic graph?
A topological sort (ordering) of a directed acyclic graph G = (V, E) is a linear ordering of all
its vertices such that if G contains an edge (u, v), then u appears before v in the ordering.
6 What is an AVL tree? Draw an AVL containing 10 nodes (of integers). Show the
balance factor of each node.
An AVL tree is a binary search tree that is height balanced, i.e., for each node x, difference
between the heights of the left and right subtrees of x (called the balance factor/number) is at
most 1.

Page 3
Example of an AVL tree with 10 nodes is as follows:

7 What do you mean by adjacency matrix of an unweighted graph G = (V, E)? Write the
adjacency matrix for the following graph.

Adjacency matrix of an unweighted graph G = (V, E) is a |V| x |V| matrix A = (aij) such that

1 if (i, j)  E
a ij =
0 otherwise

The adjacency matrix for the given graph is


1 2 3 4 5
1 0 1 1 1 0
2 0 0 1 0 0
3 0 1 0 0 0
4 0 0 0 1 0
5 0 1 0 0 0
8 What is a max tree and a max heap? Draw a max heap for the following set of integers:
5, 4, 9, 2, 1, 7.
A max tree is a binary tree in which the element in each node is greater than or equal to
those in its children (if any).
A max heap is max tree that is also a complete binary tree.

Page 4
Max heap for the given set of integers is as follows:

9 Define the terms spanning tree and minimum spanning tree? Draw the minimum
spanning tree for the following graph.

Let G = (V, E) be a connected undirected graph. A subgraph of G that is a tree and contains
all the vertices of G is a spanning tree of G.
Let G = (V, E) be a weighted, connected and undirected graph. For each edge (u, v)  E, the
weight w (u, v) specifies the cost to connect u to v. The acyclic subset (tree) T  E that
connects all of the vertices and whose total weight

is minimum, is called the minimum spanning tree of graph G.


The minimum spanning tree for the given graph is as follows:

Page 5

You might also like