# UGC NET COMPUTER SCIENCE SOLVED PAPERS 2014-16 - UGC NET Computer Science Paper 3 July 2016

>>>>>>>>UGC NET Computer Science Paper 3 July 2016

• A

6  • B

42  • C

132  • D

256  • Option : C
• Explanation :
The number of different binary trees with 6 nodes is fact(2n) / fact(n+1) * fac(n) where n is no nodes:
If n= 6, then fact(2 * n) / fact(n+1) * fac(n)
= fact(2 * 6) / fact(6 + 1) * fact(6)
= fact(12) / fact(7) * fact(6)
= 12 * 11 * 10 * 9 * 8 * fact(7) / fact(7) * fact(6)
= 12 * 11 * 10 * 9 * 8 / 6 * 5 * 4 * 3 * 2
= 6 * 11 * 2
= 132.
So, option (C) is correct.

• A

n(n-1)/2  • B

n(n-1)/4  • C

n(n+1)/4  • D

2n[logn]  • Option : B
• Explanation :
There are n(n-1)/2 pairs such that i < j. For a pair (ai, aj), probability of being inversion is 1/2. Therefore expected value of inversions = 1/2 * (n(n-1)/2) = n(n-1)/4.

• A

[26, 13, 17, 14, 11, 9, 15]  • B

[26, 15, 14, 17, 11, 9, 13]  • C

[26, 15, 17, 14, 11, 9, 13]  • D

[26, 15, 13, 14, 11, 9, 17]  • Option : C
• Explanation :
For max heap we will compare parent node(i) with its left-child(2 * i) and right-child(2 * i + 1):
• In first option node(2) < node(5) which is violating the max-heap property.
• In second option node node(2) < node(5) which is violating the max-heap property.
• In third option there is no violation.
• In fourth option node(3) < node(7) which is violating the max-heap property.
• So, option (C) is correct.

 (a) Huffman codes (i) O(n2) (b) Optimal polygon triangulation (ii) θ(n3) (c) Activity selection problem (iii) O(nlgn) (d) Quicksort (iv) θ(n)
 (a) (b) (c) (d) (1) (i) (ii) (iv) (iii) (2) (i) (iv) (ii) (iii) (3) (iii) (ii) (iv) (i) (4) (iii) (iv) (ii) (i)

• A

(1)  • B

(2)  • C

(3)  • D

(4)  • Option : C
• Explanation :
• Huffman codes takes O(nlgn) time.
• Optimal polygon triangulation takes θ(n3) time
• Activity selection problem takes θ(n) time
• Quicksort takes O(n2) time
So, option (C) is correct.

• A

925, 221, 912, 245, 899, 259, 363, 364  • B

3, 400, 388, 220, 267, 383, 382, 279, 364  • C

926, 203, 912, 241, 913, 246, 364  • D

3, 253, 402, 399, 331, 345, 398, 364  • Option : C
• Explanation :
We have to find 364 in BST:
• In first option 925 is root node, our key is less then 925 so we go for left BST. Next node is 221 → 912 → 245 → 899 → 259 → 363 → 364 respectively.
• In second option 3 is root node, we go for right BST i.e. 400 → 388 → 220 → 267 → 383 → 382 → 279 → 364 respectively.
• In third option 926 is root node, we go for left BST i.e. 203 → 912 → 241 next key is 913 we cant go for 913 after 241 because we are already in left BST of 912 our key will be surely in left BST of 912. This option is incorrect.
• In fourth option 3 is root node, we go for right BST i.e. 253 → 402 → 399 → 331 → 345 → 398 → 364.
• So, option (C) is correct.