July 17, 2021 in C and CPP
Depth first traversal of a graph produces
1.2 Depth first traversal of a graph produces
A) a spanning tree of the graph
B) a spanning forest of the graph
C) a minimal spanning tree
D) none of the above
July 17, 2021 in C and CPP
1.2 Depth first traversal of a graph produces
A) a spanning tree of the graph
B) a spanning forest of the graph
C) a minimal spanning tree
D) none of the above
July 17, 2021 in C and CPP
1.1 Referring to the sample code given below what will be new contents of array x.
int x[10] = {1,2,3,4,5,6,7,8,9,10};
int y = 20; int i = 10;
x[ - - i ] = y;
A) {1,2,3,4,5,6,7,8,9,10}
B) {20,2,3,4,5,6,7,8,9,10}
C) {1,2,3,4,5,6,7,8,9,20}
D) {1,2,3,4,5,6,7,8,20,10}
July 17, 2021 in C and CPP
b) What is a spanning tree? What do you mean by minimal spanning tree?
July 17, 2021 in C and CPP
a) Write a “C” function to compute the in-degree and out-degree of a vertex of a directed graph when the graph is represented by an adjacency list.
July 17, 2021 in C and CPP
c) Write a recursive “C” function to implement binary search.
July 17, 2021 in C and CPP
b) Find the time complexity of the simple selection sort.
July 17, 2021 in C and CPP
a) Show with the help of an example that the simple selection sort is not data sensitive.
July 17, 2021 in C and CPP
b) Consider the following binary tree

Indicate the output in the following cases: -
i) When the tree is traversed in an “inorder” fashion.
ii) When the tree is traversed in an “preorder” fashion.
iii) When the tree is traversed in an “Postorder” fashion.
July 17, 2021 in C and CPP
a) Prove that the maximum number of nodes in a binary tree of height “k” is 2^k+1-1.
July 17, 2021 in C and CPP
b) A function A(m,n) is defined as follows.
A(m,n) = n + 1, if m = 0
= A ( m – 1, 1), if n = 0
= A(m – 1, A(m, n-1)), otherwise
write a recursive “C” function to compute A(m,n)